Skip to main content

Command Palette

Search for a command to run...

Understanding Bridge vs JSI in ReactNative

Updated
2 min readView as Markdown
Understanding Bridge vs JSI in ReactNative
F

I build high-impact product for startups which meets human needs and experience.✨

One of the biggest advantages as a React Native Developer building mobile applications is by allowing developers to build native applications using JavaScript. However, the way JavaScript communicates with native code has evolved significantly. This articles explores the two fundamental architectures:

- The Bridge (the original approach)
- JSI (JavaScript Interface) (the modern solution).

Understanding these concepts is crucial for any React Native developer, technical lead, or architect making decisions about mobile app development because JavaScript (your code) and Native code (Swift/Java) speak different languages and need a way to communicate.

However, Before going into Bridge vs JSI, let's understand what problem they solve.

The Core Challenge: React Native apps have three separate realms:

  • JavaScript Realm: Where your React code runs

  • Native Realm: Where iOS (Objective-C/Swift) and Android (Java/Kotlin) code runs

  • UI Realm: Where the actual native UI components are rendered

These realms need to communicate constantly. For example, when you press a button in JavaScript, that needs to trigger native code, which then updates the UI.
This is where bridge or JSI comes in....

1. BRIDGE (Old Way)

(JS Object → JSON → Queue → Wait → Copy → Parse → Native)

The communication here is between JavaScript and native code through a message queue system using JSON serialization where by JavaScript requests are converted to JSON messages (containing module name, method, and arguments), queued, then deserialized on the native side for execution then the responses are returned via callbacks or promises.

Think of it like two people speaking different languages, needing a translator for every conversation.

2. JSI (New way)

(JS → Direct Call → Native)

In the concept of JSI, it eliminates the asynchronous Bridge method by enabling direct calling of native code through host objects that wrap native code. This allows JavaScript to hold direct references as pointers or memory addresses to the shared memory space/objects between JS and native code without any serialization.

These performance advantages make JSI the clear choice for modern React Native development, which is why Expo SDK 50+ has adopted it by default.

JSI Core Advantages Over Bridge

1.Synchronous and direct function calls (vs Bridge's asynchronous)

2.Native objects with no serialization (vs Bridge's JSON conversion)

3.Shared memory with direct pointers (vs Bridge's separate memory and copying)

4. Direct host object invocation (vs Bridge's message queue and batching delays)

5. 100x faster performance (0.1-1ms vs 50-100ms per call)

JSI isn't just an optimization, it's a fundamental reimagining of React Native's architecture. While migration requires effort, the performance benefits and improved developer experience make it worthwhile for serious and scalable applications.