What is the difference between React Native and React?

后端 未结 30 2694
粉色の甜心
粉色の甜心 2020-11-28 00:22

I have started to learn React out of curiosity and wanted to know the difference between React and React Native - though could not find a satisfactory answer using

30条回答
  •  醉酒成梦
    2020-11-28 00:46

    First, the similarities: Both React & React Native (RN) were designed to create flexible user interfaces. There are tons of benefits to these frameworks, but the most fundamental take-away is that they're made for UI-development. Facebook developed RN a few years after React.

    React: Facebook designed this framework to be almost like writing your JavaScript inside of your HTML/XML, which is why the tags are called "JSX" (JavaScript XML) and are similar to the familiar HTML-like tags such as

    or

    . A hallmark of React is the capital-letter tags which denote a custom component, such as , which also exists in RN. However, React uses the DOM. The DOM exists for HTML, thus React is used for web development.

    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

    tags, RN developers use RN's built-in tag, which compiles into other native code under the hood (e.g. android.view on Android; and UIView on iOS).

    In short: they're very similar (for UI development) but used for different mediums.

提交回复
热议问题