Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between React Native and React?

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 Google. React and React Native seems to have the same format. Do they have completely different syntax?

like image 942
shiva kumar Avatar asked Jan 06 '16 19:01

shiva kumar


People also ask

Is React Native and React same?

React Native is same as React, but it uses native components instead of using web components as building blocks. It targets mobile platforms rather than the browser. Facebook develops the React Native in 2013 for its internal project Hackathon.

Which is better React or native?

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.

What are React and React Native used for?

React is a library for frontend web development while React Native is a framework that facilitates cross-platform compatibility for mobile application development. In React Native you simply write a React code but it acts as a bridge between JavaScript(JS) and mobile's native properties.

Should I learn React or React Native?

Should I learn React before learning React Native? Creating native mobile apps in React Native is very similar to developing web apps in React in some respect. If you don't have much technical knowledge and experience with web development yet, it's worth you get familiar with React first.


2 Answers

Here is the React project.

At Facebook, they invented React so JavaScript can manipulate the website DOM faster using the virtual DOM model.

DOM full refresh is slower compared to the React virtual-dom model, which refreshes only parts of the page (read: partial refresh).

As you may understand from this video, Facebook did not invent React because they understood immediately that the partial refresh would be faster than the conventional one. Originally they needed a way to reduce Facebook application re-build time and luckily this brought the partial DOM refresh to life.

React native is just a consequence of React. It is a platform to build native apps using JavaScript.

Prior to React native you needed to know Java for Android or Objective-C for iPhone and iPad to create native apps.

With React Native it is possible to mimic the behavior of the native app in JavaScript and at the end, you will get platform specific code as the output. You may even mix the native code with the JavaScript if you need to optimize your application further.

As Olivia Bishop said in the video, 85% of the React native code base can be shared among platforms. These would be the components applications typically use and the common logic.

15% of the code is platform specific. The platform-specific JavaScript is what gives the platform flavor ( and makes the difference in the experience ).

The cool thing is this platform specific code — is already written, so you just need to use it.

like image 27
prosti Avatar answered Oct 01 '22 03:10

prosti


ReactJS is a JavaScript library, supporting both front-end web and being run on a server, for building user interfaces and web applications. It follows the concept of reusable components.

React Native is a mobile framework that makes use of the JavaScript engine available on the host, allowing you to build mobile applications for different platforms (iOS, Android, and Windows Mobile) in JavaScript that allows you to use ReactJS to build reusable components and communicate with native components further explanation

Both follow the JSX syntax extension of JavaScript. Which compiles to React.createElement calls under the hood. JSX in-depth

Both are open-sourced by Facebook.

like image 157
Nader Dabit Avatar answered Oct 01 '22 05:10

Nader Dabit