Difference between React and React-Native
- Platform:-
React (React.js) : A java script library used for building web applications it focuses on creating user interface for website.
React Native : a framework for building mobile application (for Android & ios) using java script and React. it allows developers to create mobile apps with native like performance.
- Rendering :
React : Renders component using HTML and CSS in a web browser like <div/>,<h1/>,<p/> etc. it creates a virtual DOM (Document object Model). which update the actual web page efficiently.
React Native: Renders components using native components instead of HTML it uses platform-specific component like <View/>,<Text/> and <Image/> the map to actual native UI elements of ios and android,providing a more native look and feel.
- Styling :
React : it uses traditional CSS(Cascading Style Sheets) for styling , with options for CSS framework , Preprocessor like Sass (Syntactically Awesome Style Sheet) or inline styling.
React Native : it uses java script based styling (similar to inline style in React) where styles are defined in a javaScript Object no traditional CSS (Cascading Style Sheets) , but a system of Stylesheet.Create to handle styles.
- Navigation :
React : Navigation on the web is handled using routers, like React router. links and routes change the URL in the web browser.
React Native : Navigation is different since mobile apps don’t have URLs (Uniform Resource Locator) like web page. it uses libraries like React Navigation or React Native Navigation for mobile -style navigation, such as stack-based or tab-based navigation.
- Code sharing :
React : You wrote code specifically for the web, which is not reusable for mobile apps.
React-Native : you can share some code logic like state management business logic) between web and mobile apps, but UI component and layout will need to be different for mobile.
- Goal:
React : Mainly used for building single-page web Application (SPA) that update dynamically without refreshing the entire page.
React-Native : used for building mobile apps that feel and function like native ios and android apps.