我已经开始学习React出于好奇,想知道React和React Native之间的区别-虽然不能找到一个满意的答案使用谷歌。React和React Native似乎有相同的格式。它们的语法完全不同吗?
当前回答
React Native是一个开源的移动应用程序框架。 React JS是前端javascript库,它是一个很大的库,而不是一个框架。
其他回答
React Js使用HTML Dom进行操作。 但是React native使用的是移动(iOS/android)原生ui组件。
React-Native是一个用于开发Android和iOS应用程序的框架,它共享80% - 90%的Javascript代码。
而React.js是用于开发web应用程序的父Javascript库。
当你在React-Native中使用像<View>, <Text>这样的标签时,React.js使用像<div> <h1> <h2>这样的web html标签,这只是web/移动开发词典中的同义词。 对于React.js,你需要DOM来渲染html标签的路径,而对于移动应用程序:React-Native使用AppRegistry来注册你的应用程序。
我希望这是一个简单的解释React.js和React-Native的快速差异/相似之处。
一个简单的比较应该是
反应Js
return(
<div>
<p>Hello World</p>
</div>
)
反应本地
return(
<View>
<Text>Hello World</Text>
</View>
)
React Native没有像div, p, h1等Html元素,相反,它有对移动设备有意义的组件。 详情见https://reactnative.dev/docs/components-and-apis
React-Native是一个框架,其中ReactJS是一个javascript库,可以用于您的网站。
React-native提供了默认的核心组件(图像,文本),其中React提供了一堆组件并使它们协同工作。
反应
React is used for creating websites, web apps, SPAs etc. React is a Javascript library used for creating UI hierarchy. It is responsible for rendering of UI components, It is considered as V part Of MVC framework. React’s virtual DOM is faster than the conventional full refresh model, since the virtual DOM refreshes only parts of the page, Thus decreasing the page refresh time. React uses components as basic unit of UI which can be reused this saves coding time. Simple and easy to learn. React Native React Native is a framework that is used to create cross-platform Native apps. It means you can create native apps and the same app will run on Android and ios. React native have all the benefits of ReactJS React native allows developers to create native apps in web-style approach.