TurboModules & JSI: Future‑Proof Native Modules in React Native
Learn how TurboModules and the JavaScript Interface (JSI) let you write faster, type‑safe native modules without the bridge overhead.
Insight
TurboModules replace the classic bridge with a direct C++/JSI link, eliminating serialization costs and enabling synchronous calls from JavaScript. When you register a module as a TurboModule, the runtime loads it once and keeps a native pointer, so subsequent method calls are just function calls on the C++ side. This results in measurable latency drops, especially for high‑frequency APIs like sensor polling or crypto operations.
Example
// src/native/DeviceInfo.ts
import {TurboModuleRegistry} from 'react-native';
export interface DeviceInfoSpec {
getBatteryLevel(): Promise<number>;
}
const DeviceInfo = TurboModuleRegistry.getEnforcing<DeviceInfoSpec>('DeviceInfo');
export default DeviceInfo;
The native side implements DeviceInfo as a C++ JSI module, exposing getBatteryLevel without any async bridge.
Takeaway
If you need low‑latency native calls, migrate performance‑critical modules to TurboModules/JSI. The migration is incremental—keep existing bridge modules and only rewrite the hot paths for a noticeable speed boost.