What is the technological difference between "react-native" and "Apache Cordova"?
I have been working with Cordova for a while now and the way it works is, it creates a webview (a headless browser) and runs the application inside of it with various API access. I have been wondering if same is true for "react-native". Does "react-native" also create webview? or does it convert javascript code to native code?
If it creates a "webview" like Cordova, then what is the difference between a "Cordova + React" app and a "react-native" app (excluding the native-components that are provided by react-native)?
I know there is already an answer to this type of question here: Phone gap vs React Native. But my question is a bit different. Thank you.
No. React Native is an abstraction to write native User Interfaces for Android and IOS. Your Javascript code runs in a Javascript runtime on the OS, but the UI is rendered as native components. This makes it very different than Cordova/PhoneGap.
This is mentioned on the React Native webpage:
And explained in more detail in this blog post:
difference between react native and cordova ?
1.What is..
React Native:
React Native is based on React (a JavaScript framework) to design apps UI using JavaScript. It supports both Android and iOS to develop hybrid apps. Basically, React Native apps don’t use WebViews to render the app UI as in Cordova. A JavaScript interpreter is embedded to run only the JS code of the app.
Cordova:
Cordova is another open source JavaScript framework to design hybrid apps. Cordova apps use WebViews to render the user interface of the app. Cordova also allows developers to use latest web technologies like HTML5, JS, etc. to design apps for Android, iOS, and Windows.
2.Performance..
React Native:- Apps developed using React Native are faster than Cordova apps but slower than native ones.
Cordova:- Cordova apps are just Webviews which makes them sluggish and less responsive.
3.Supported Platforms..
React Native:- Android and iOS.
Cordova:- Android, iOS and Microsoft UWP.
4.Interaction with device core components..
React-Native:-React Native renders the UI written in HTML as native components which make the app interaction with the core device components faster.
Cordova:-Interaction with core device components is slower as compared to React Native apps.
5.Maturity..
React Native:-React Native is less mature than Cordova in terms of the number of available plugins.
Cordova:-Cordova is more stable than React Native.
6.Backward compatibility..
React Native:-Little support for old platforms. React Native doesn’t support iOS 7.
Cordova:-Better support for old platforms.
7.Portability..
React Native:-In React Native, there is a less code reuse as compared to Cordova. You have to almost reimplement code for different platforms.
Cordova:-Apache Cordova code written for one platform can be easily ported to a different platform without much of any headaches.
8.Debugging..
React Native:-The UI of a React Native app is debugged in the application itself and the JavaScript is debugged in the Chrome Developer Console. While debugging a React native app, the device only needs to be connected for the very first time only. After that, the debugging process can be done over a LAN. Also, debugging of React Native apps is simpler and easier than debugging of Cordova apps.
Cordova:-In Cordova apps, the UI and JavaScript are debugged in the Chrome Developer Console. While debugging a Cordova app, your device needs to be connected to the system.
9.When to use..
React Native:-Use React Native when you want to develop cross-platform apps with a more native feel and faster performance.
Cordova:-Cordova is best suited when you want to quickly convert your web application into a cross-platform but it comes with a cost of less native feel and slow performance.
I Think this answer is very helpful for you. Thankyou..