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


当前回答

反应本地

它是一个使用JavaScript构建本地应用程序的框架。 它编译为本地应用程序组件,这使它成为可能 构建原生移动应用程序。 不需要彻底检查你的旧应用程序。你所要做的就是添加React 将本地UI组件添加到现有应用程序代码中,而不必这样做 重写。

js的反应

它既支持前端web,也支持在服务器上运行 构建用户界面和web应用程序。 它还允许我们创建可重用的UI组件。 你可以在React JS中重用代码组件,节省大量时间。

其他回答

首先是相似之处: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开发),但用于不同的媒介。

一些区别如下: 1- React-Native是一个用于创建移动应用程序的框架,其中ReactJS是一个javascript库,可以用于您的网站。 2- React- native不使用HTML来渲染应用程序,而React使用。 3- React- native只用于开发移动应用程序,而React用于网站和移动。

简单地说,React和React native遵循相同的设计原则,除了在设计用户界面的情况下。

React本机有一组单独的标记来定义user 但是两者都使用JSX来定义组件。 这两个系统的主要目的是开发可重用的ui组件,并通过其组合减少开发工作。 如果你正确地规划和构建代码,你可以在移动和web上使用相同的业务逻辑

无论如何,它是一个为移动和网络构建用户界面的优秀库。

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的快速差异/相似之处。

反应

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.