In this lesson, you will learn how TurboModules leverage lazy loading to prevent your app from stalling during startup.
The Old Way: A Heavy Start
In the older React Native architecture, whenever your application started, it had to initialize every single Native Module you had installed—even if your app only needed a few of them. Imagine trying to start a car, but before the engine turns on, you have to load every single item from the trunk into the front seat. This "eager loading" is why some apps have a slow "cold-start" time; the JavaScript bridge is busy waking up dozens of native services before the user can even tap a button.
The New Way: Lazy Loading
TurboModules change this by introducing lazy loading. Instead of initializing all native code upfront, React Native now keeps these modules in a "wait-and-see" state.
Think of it like a smart library: instead of carrying every book in the building to your desk the moment you sit down, you only request the specific book you need. When your JavaScript code finally calls a method from a TurboModule, the system performs a "just-in-time" load.
How it looks
From your perspective as a developer, you aren't manually triggering these loads. Instead, you define your module using Codegen, which tells the engine how to find the native code:
// A hypothetical TurboModule interaction
import { NativeModules } from 'react-native';
// The module isn't fully initialized until this line is executed
const myTurboModule = NativeModules.MyTurboModule;
myTurboModule.performTask();
By delaying the initialization of native components until the exact moment they are invoked, the app can show your initial screen much faster. The bridge stays quiet during the critical launch phase, only interacting with native modules when the user actually interacts with a feature that requires them. This dramatically reduces the "Time to Interactive" for your users.
Key Takeaway: TurboModules improve cold-start performance by loading native code on demand only when it is actually called, rather than initializing everything during the app’s launch sequence.