How JavaScript Runs Inside React Native
React Native allows developers to build mobile applications using JavaScript while still delivering near-native performance. Unlike React for the web, React Native does not run inside a browser. There is no DOM, no HTML, and no CSS in the traditional sense.
This raises an important question:
How does JavaScript actually run inside a React Native app?
This article explains, at a beginner level, how JavaScript runs under the hood in React Native and how it communicates with native mobile code.
Understanding React Native Architecture
At a high level, React Native is built on three main layers:
1. JavaScript Thread
2. Native Thread
3. Bridge (Communication Layer)
Each of these layers plays a role in executing JavaScript and rendering user interfaces on mobile devices.
The JavaScript Thread
At the core of every React Native app is the JavaScript thread.
This is where:
1. Your React Native code runs
2. Component logic is executed
3. State updates happen
4. API calls and business logic are handled
React Native does not use the browser’s JavaScript engine. Instead, it embeds a JavaScript engine directly inside the mobile app.
JavaScript Engines Used in React Native
Depending on the platform and configuration, React Native uses:
1. JavaScriptCore (JSC)
Default on iOS and Previously used on Android
2. Hermes
A lightweight JavaScript engine built specifically for React Native and Improves app startup time and reduces memory usage
These engines execute JavaScript code similarly to how a browser would, but without a DOM.
The Native Thread
The native thread handles everything related to the mobile platform itself, including:
Rendering UI components
Handling touch events
Running animations
Accessing device features such as the camera, GPS, and sensors
React Native components like <View>, <Text>, and <Image> are not web elements. They are mapped to real native components:
iOS → UIKit components
Android → Android View system components
So when you write React Native UI code, it eventually becomes actual native UI elements on the device.
The Communication Problem
Even though JavaScript is running inside the app, it cannot directly talk to native Android or iOS code because:
JavaScript and native code are written in different languages
They run in different environments
They cannot directly call each other’s functions
This language difference creates a communication barrier.
The Bridge: How JavaScript Talks to Native Code
To solve this problem, React Native introduced a system called the Bridge.
The Bridge acts as a translator between JavaScript and native code.
How the Bridge Works
JavaScript sends instructions
These instructions are serialized
They are converted into JSON
The JSON passes through the Bridge
Native code receives the message and executes it
Results are sent back to JavaScript using the same process
In simple terms:
JavaScript → JSON → Native
Native → JSON → JavaScript
This communication is asynchronous, meaning JavaScript does not block native operations and native code does not block JavaScript.
Example
Get odedeyi oladapo’s stories in your inbox
Join Medium for free to get updates from this writer.
When you write:
setState({ count: count + 1 });
Behind the scenes:
JavaScript calculates the new state
Sends UI update instructions through the Bridge
Native code updates the UI on the screen
This system made React Native possible in the first place.
Limitations of the Bridge
While the Bridge works well, it has some drawbacks:
Serializing data into JSON takes time
Large or frequent data transfers can affect performance
Everything being asynchronous can introduce delays
As React Native apps became more complex, these limitations became more noticeable.
Evolution of React Native: JSI, TurboModules, and Fabric
To improve performance, React Native introduced a newer architecture.
JavaScript Interface (JSI)
JSI is a newer way for JavaScript and native code to communicate.
At a high level:
JSI is built using C++
It reduces the need for heavy JSON serialization
JavaScript can interact with native code more directly
Communication becomes faster and more efficient
TurboModules
TurboModules improve how native modules are loaded:
Native modules are lazy-loaded
Faster app startup
Better performance and scalability
Fabric Renderer
Fabric is the new rendering system for React Native:
Improves UI consistency
Enables concurrent rendering
Makes animations smoother
Fabric works closely with JSI to improve overall performance.
Threads in React Native
React Native typically runs multiple threads:
JavaScript Thread — Runs JavaScript logic
UI Thread — Renders the user interface
Native Modules Thread — Handles heavy native operations
If JavaScript blocks the JS thread (for example, with long loops or heavy computations), the UI may become unresponsive. This is why performance optimization is important.
Helpful Learning Resource
This video explains the Bridge and why React Native later introduced improvements like JSI:
👉 https://youtu.be/TU_kTuz2i9Y
Summary
JavaScript in React Native:
Runs inside an embedded JavaScript engine (JSC or Hermes)
Executes on a dedicated JavaScript thread
Does not run in a browser
Communicates with native code using the Bridge (originally)
Uses newer systems like JSI to improve performance
React Native combines:
JavaScript flexibility
Native performance
A well-designed communication system
Conclusion
Understanding how JavaScript runs inside React Native helps developers:
Write better-performing apps
Avoid blocking the JavaScript thread
Understand how React Native differs from web React







