我已经开始学习React出于好奇,想知道React和React Native之间的区别-虽然不能找到一个满意的答案使用谷歌。React和React Native似乎有相同的格式。它们的语法完全不同吗?


当前回答

REACT是一个Javascript库,用于构建像Facebook这样的大型/小型界面web应用程序。

REACT NATIVE是一个Javascript框架,用于开发Android、IOS和Windows Phone上的原生移动应用程序。

两者都是由Facebook开源的。

其他回答

React Js是一个前端javascript库,它是一个很大的库,而不是一个框架

它遵循有助于构建的基于组件的方法 可重用的UI组件 它用于开发复杂的交互式web和移动UI 尽管它在2015年才开源,但它拥有最大的社区之一支持它。

ReactNative是一个开源的移动应用程序框架。

首先是相似之处:React和React Native (RN)都是为了创建灵活的用户界面而设计的。这些框架有很多好处,但最基本的一点是它们是为ui开发而设计的。Facebook在React之后几年开发了RN。

反应: Facebook设计的这个框架几乎就像在HTML/XML中编写JavaScript,这就是为什么标签被称为“JSX”(JavaScript XML),类似于我们熟悉的类似HTML的标签,如<div>或<p>。React的一个标志是大写字母标记,它表示自定义组件,例如<MyFancyNavbar />,它也存在于RN中。然而,React使用DOM。DOM是为HTML而存在的,因此React是用于web开发的。

React Native: RN does not use HTML, and therefore is not used for web development. It is used for... virtually everything else! Mobile development (both iOS & Android), smart-devices (e.g. watches, TVs), augmented reality, etc. As RN has no DOM to interact with, instead of using the same sort of HTML tags used in React, it uses its own tags which are then compiled into other languages. For example, instead of <div> tags, RN developers use RN's built-in <View> tag, which compiles into other native code under the hood (e.g. android.view on Android; and UIView on iOS).

简而言之:它们非常相似(对于UI开发),但用于不同的媒介。

React is a framework for building applications using JavaScript. React Native is an entire platform allowing you to build native, cross-platform mobile apps, and React.js is a JavaScript library you use for constructing a high performing UI layer. React.js is the heart of React Native, and it embodies all React’s principles and syntax, so the learning curve is easy. The platform is what gave rise to their technical differences. Like the browser code in React is rendered through Virtual DOM while React Native uses Native API’s to render components on mobile. React uses HTML and with React Native, you need to familiarize yourself with React Native syntax. React Native doesn’t use CSS either. This means you’ll have to use the animated API which comes with React Native to animate different components of your application.

最重要的是,React是为你的web界面构建动态,高性能,响应性UI的理想选择,而React Native是为了给你的移动应用程序一个真正的原生感觉。

雷夫:what-is-the-difference-between-react-js-and-react-native

React-Native是一个框架,其中ReactJS是一个javascript库,可以用于您的网站。

React-native提供了默认的核心组件(图像,文本),其中React提供了一堆组件并使它们协同工作。

这里有一个很好的解释:

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/