ReactJS and React Native similarities and differences
React Native, a mobile-app development framework hybrid available for iOS and Android, was released 4 years later, after the popularity of ReactJS increased due to the Facebook’s team open sourcing it. ReactJS and React Native are similar in one way, but in others they are completely different.
Contrary to ReactJS, where the developer has to choose a bundler while trying to pick which of the bundling modules will be best for the project, React Native delivers everything needed. Coding of the first native app can start shortly after you type one command line, making RN easy and fast to set up.
All the HTML
React Native doesn’t use HTML for app rendering. Instead, delivers components working similarly and most of them can be translated into their equivalents in HTML, e.g. <View> to <div> and <Text> to something like a mixup of <span> and <p>. Due to this, the libraries used with ReactJS cannot be used in the React Native framework. React Native doesn’t use CSS tags, or rather uses them in a different way, similarly to Flexbox.
Gestures and animations
React Native provides a library similar to Velocity.js called Animated. React-Native also provides LayoutAnimation, which unfortunately is only well supported by iOS.
For interaction with user’s gestures, React Native provides PanResponder. By applying it to a View you enable the touch handler on it.
Although there are more differences than similarities between ReactJS and React Native, some characteristics are relevant to both. People tend to say that the main similarity of the two is the lack of documentation on both. On the contrary, since the release of React 16 the documentation is great and is available on the official website.
You can use most developer tools dedicated for ReactJS in the RN framework, e.g. Chrome Dev Tools for displaying the console logs and inspecting the network requests or Redux DevTools for inspecting the state of the Redux store.
- React Native doesn’t use HTML
- ReactJS gives all the advantages of React Native
- ReactJS and React Native both follow component-based architecture
- You can write native mobile components in React Native to give off the feeling of a mobile app