React Native & Expo (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is the JSI (JavaScript Interface) in the New Architecture?
senior LevelCode ExampleTypeScriptSystem Design
In Simple Words: JSI is a lightweight, general-purpose C++ abstraction layer:
- Allows the JavaScript runtime (Hermes) to directly hold a reference to a C++ Host Object, and vice versa.
- JavaScript can call native C++ and Swift/Kotlin methods synchronously in nanoseconds without serializing payloads to JSON or passing through an asynchronous message queue!
- Foundation of modern high-performance libraries like Reanimated 3, MMKV, and VisionCamera.
text
Old Bridge vs New JSI Architecture:
Old Architecture: [JS Thread] ──(JSON Stringify)──► [Async Bridge Queue] ──(JSON Parse)──► [Native UI]
New Architecture: [JS Thread] ◄────────────(Direct JSI C++ Calls)────────────► [Native UI (Fabric)]