我已经开始学习React出于好奇,想知道React和React Native之间的区别-虽然不能找到一个满意的答案使用谷歌。React和React Native似乎有相同的格式。它们的语法完全不同吗?
当前回答
React是React Native和React DOM的基本抽象,所以如果你要使用React Native,你还需要React…与web相同,但不是React Native,你将需要React DOM。
由于React是基本抽象,一般语法和工作流是相同的,但你将使用的组件是非常不同的,因此你需要学习这些差异,这是内联React,所谓的moto,即“一次学习,随处编写”,因为如果你知道React(基本抽象),你可以简单地学习平台之间的差异,而不学习另一种编程语言,语法和工作流。
其他回答
简单地说,React和React native遵循相同的设计原则,除了在设计用户界面的情况下。
React本机有一组单独的标记来定义user 但是两者都使用JSX来定义组件。 这两个系统的主要目的是开发可重用的ui组件,并通过其组合减少开发工作。 如果你正确地规划和构建代码,你可以在移动和web上使用相同的业务逻辑
无论如何,它是一个为移动和网络构建用户界面的优秀库。
React是一个声明性的、高效的、灵活的JavaScript库,用于构建用户界面。你的组件告诉React你想要呈现什么——然后当你的数据发生变化时,React会有效地更新并呈现正确的组件。这里,ShoppingList是一个React组件类,或者React组件类型。
React Native应用程序是真正的移动应用程序。使用React Native,你不需要构建“移动web应用程序”、“HTML5应用程序”或“混合应用程序”。你构建了一个真正的移动应用,它与使用Objective-C或Java构建的应用没有什么区别。React Native使用与常规iOS和Android应用相同的基本UI构建块。
更多信息
这里有一个很好的解释:
Reactjs是一个同时支持前端和服务器的JavaScript库。此外,它还可以用于为移动应用程序和网站创建用户界面。
React Native是一个跨平台的移动框架,使用Reactjs来构建应用程序和网站。React Native编译成本地应用程序组件,使程序员能够用JavaScript构建可以在不同平台(如Windows、Android、iOS)上运行的移动应用程序。
Reactjs can be described as a base derivative of React DOM, for the web platform while React Native is a base derivative in itself, which means that the syntax and workflow remain the same, but components alter. Reactjs, eventually, is a JavaScript library, which enables the programmer to create an engaging and high performing UI Layer while React Native is an entire framework for building cross-platform apps, be it web, iOS or Android. In Reactjs, virtual DOM is used to render browser code in Reactjs while in React Native, native APIs are used to render components in mobile. The apps developed with Reactjs renders HTML in UI while React Native uses JSX for rendering UI, which is nothing but javascript. CSS is used for creating styling in Reactjs while a stylesheet is used for styling in React Native. In Reactjs, the animation is possible, using CSS, just like web development while in React Native, an animated API is used for inducing animation across different components of the React Native application. If the need is to build a high performing, dynamic, and responsive UI for web interfaces, then Reactjs is the best option while if the need is to give mobile apps a truly native feeling, then React Native is the best option.
更多信息请点击:https://www.simform.com/reactjs-vs-reactnative/
简单来说 ReactJS是父库,它返回一些东西来渲染每个主机环境(浏览器,移动,服务器,桌面等)。 除了渲染,它还提供了其他方法,如生命周期钩子..等。
在浏览器中,它使用另一个库react-dom来呈现DOM元素。 在移动端,它使用React-Native组件来呈现特定平台(IOS和Android)的本地UI组件。 所以,
React + React -dom = web开发
React + React -native =移动开发
一些区别如下: 1- React-Native是一个用于创建移动应用程序的框架,其中ReactJS是一个javascript库,可以用于您的网站。 2- React- native不使用HTML来渲染应用程序,而React使用。 3- React- native只用于开发移动应用程序,而React用于网站和移动。
推荐文章
- 我如何使用Jest模拟JavaScript的“窗口”对象?
- 在应用程序启动时出现“无法获得BatchedBridge,请确保您的bundle被正确打包”的错误
- React组件中使用TypeScript的默认属性值
- 我如何等待一个承诺完成之前返回一个函数的变量?
- 在JavaScript中根据键值查找和删除数组中的对象
- 使嵌套JavaScript对象平放/不平放的最快方法
- 如何以及为什么'a'['toUpperCase']()在JavaScript工作?
- 有Grunt生成index.html不同的设置
- 文档之间的区别。addEventListener和window。addEventListener?
- 如何检查动态附加的事件监听器是否存在?
- 如何写setTimeout与参数Coffeescript
- 将JavaScript字符串中的多个空格替换为单个空格
- JavaScript: override alert()
- 重置setTimeout
- 如何确保<select>表单字段被禁用时提交?