Difference Between React Native and React: Architecture, Components, and Platform Implementation
React is a JavaScript library for building user interfaces that targets the browser's DOM, while React Native is a framework that uses React's core reconciler to render truly native platform UI components on iOS and Android.
The facebook/react repository powers both technologies through a shared core architecture. While developers often use "React" to refer to web development and "React Native" for mobile apps, the technical distinction lies in the renderer layer that translates JavaScript code into platform-specific UI elements.
Core Architecture: Reconciler and Renderers
The fundamental difference between React and React Native exists at the architectural level within the facebook/react codebase. React employs a reconciler pattern that separates platform-agnostic logic from rendering targets.
The reconciler (implemented in the react-reconciler package) handles component state, lifecycle methods, and the virtual DOM diffing algorithm. However, it does not directly manipulate UI elements. Instead, it communicates with platform-specific renderers through an internal host configuration interface.
React DOM serves as the renderer for web applications. It translates virtual DOM nodes into browser-specific HTML elements like <div> and <span>, managing browser events and DOM mutations.
React Native acts as a renderer for mobile platforms. Rather than generating HTML, it creates native platform views (UIView on iOS, android.view.View on Android) through a bridge that serializes JavaScript commands to native code.
Component Differences: DOM Elements vs. Native Views
The component APIs differ significantly between React and React Native, reflecting their distinct rendering targets.
In React for web, you use browser-standard HTML elements:
import React from 'react';
function WebComponent() {
return (
<div className="container">
<h1>Hello Web</h1>
<p>This renders as HTML elements</p>
<button onClick={handleClick}>Click me</button>
</div>
);
}
In React Native, you import platform-agnostic components that map to native views:
import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
function NativeComponent() {
return (
<View style={styles.container}>
<Text>Hello Mobile</Text>
<Text>This renders as native UI views</Text>
<Button title="Click me" onPress={handlePress} />
</View>
);
}
const styles = StyleSheet.create({
container: {
padding: 20,
},
});
Key distinctions:
- View replaces
<div>as the generic container - Text explicitly wraps all text content (unlike web where text can be direct children)
- StyleSheet replaces CSS with JavaScript-based styling objects
- Event handlers use
onPressinstead ofonClickfor touch interactions
Styling and Layout Engines
React uses the browser's CSS engine for styling and layout, supporting the full CSS specification including Grid, Flexbox, and absolute positioning.
React Native uses the Yoga layout engine (originally developed by Meta) which implements a subset of Flexbox. Styles are written in JavaScript objects rather than CSS:
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
text: {
fontSize: 20,
fontWeight: 'bold',
color: '#333333',
},
});
Critical limitations:
- React Native supports only Flexbox and absolute positioning (no CSS Grid until recent versions)
- Styles are camelCase (e.g.,
backgroundColornotbackground-color) - No CSS inheritance except for Text components
- Units are density-independent pixels (dp), not px or rem
Platform API Access
React applications access browser APIs directly: the DOM, Fetch API, Web Storage, Geolocation, and WebSockets.
React Native requires bridging to access native platform capabilities. The architecture uses a bridge (in the legacy architecture) or JavaScript Interface (JSI) (in the new architecture) to communicate between JavaScript and native code:
// Accessing platform-specific APIs in React Native
import { Platform, NativeModules, NativeEventEmitter } from 'react-native';
// Platform-specific code
const styles = StyleSheet.create({
container: {
...Platform.select({
ios: {
paddingTop: 50,
},
android: {
paddingTop: 20,
},
}),
},
});
// Accessing native modules
const { CalendarModule } = NativeModules;
CalendarModule.createCalendarEvent('Meeting', 'Conference Room');
Key architectural differences:
- React Native runs in a separate JavaScript thread, not the main UI thread
- Native modules must be explicitly bridged, unlike web APIs which are immediately available
- Platform-specific code requires conditional logic or separate files (
.ios.jsvs.android.js)
Summary
- React is a JavaScript library for building web UIs using the browser's DOM, CSS, and Web APIs.
- React Native is a framework that uses React's reconciler to render native mobile UI components on iOS and Android.
- Both share the same core reconciler from the facebook/react repository, but use different renderers (React DOM vs React Native).
- React uses HTML elements and CSS; React Native uses platform-agnostic components (
<View>,<Text>) and JavaScript-based styling. - React accesses browser APIs directly; React Native requires bridging to access native platform capabilities.
Frequently Asked Questions
Can I use React code directly in a React Native application?
No, you cannot use React web components directly in React Native. While the JavaScript logic and React hooks remain identical, the component layer differs significantly. React uses HTML elements like <div> and <span>, while React Native requires specific native components like <View> and <Text>. You must rewrite your JSX components to use React Native's component API, though your business logic and state management can remain unchanged.
Do React and React Native use the same version of React?
Yes, React Native depends on the same core React library from the facebook/react repository. When you install React Native, it includes a specific version of the react package as a peer dependency. The reconciler algorithm, hooks implementation, and component lifecycle logic are identical between web and mobile. The divergence occurs at the renderer level, where React DOM and React Native implement platform-specific host configurations to communicate with their respective UI environments.
Is React Native slower than React for web because of the bridge?
Not necessarily. While React Native's legacy architecture used a JavaScript bridge that serialized data between JS and native threads (potentially causing performance bottlenecks), the new architecture (Fabric and TurboModules) uses the JavaScript Interface (JSI) to enable direct memory sharing between JavaScript and native code. React for web also faces performance constraints when manipulating the DOM or executing complex calculations on the main thread. Both platforms can achieve 60 FPS animations when optimized correctly, though React Native requires careful handling of bridge communication in the legacy architecture.
Can I share code between a React web app and React Native app?
Yes, you can share significant portions of code between platforms using strategies like monorepos, shared libraries, or cross-platform frameworks. Business logic, utility functions, custom hooks, and state management (Redux, Zustand, React Query) work identically across both platforms. You cannot share JSX components directly due to the different rendering targets, but you can share component logic using custom hooks or by creating platform-agnostic design systems that abstract the platform-specific implementations behind a common API. Tools like React Native Web can also render React Native components in the browser, enabling true code sharing for some use cases.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s https://instagit.com/install.md Maintain an open-source project? Get it listed too →