Skip to content
Preview: packages are not published yet.
Learn · board 2

Boot in stages

Starting the JavaScript runtime is work on the main thread. It happens in four stages, and your app chooses when to pay for the first three. Watch the same launch under each boot policy.

step 5 / 5
app launch
native screens
first surface opens
second surface
.lazy
nothing runs
no React cost
1 createHermes2 prepareBytecode3 evaluate4 mount
4 mount
.eager
1 createHermes2 prepareBytecode3 evaluate
no React cost
4 mount
4 mount
Same total work, paid at a different moment..lazy keeps launch untouched and makes the first surface slower..eager makes launch heavier and the first surface fast. Stages 1 to 3 run once per runtime; stage 4 runs each time a surface opens.
  1. 1The app launches. With .eager, stages 1 to 3 run inside start, before the first frame. With .lazy, nothing runs.
  2. 2The person uses native screens. Neither policy costs anything here. The runtime is either ready or not created yet.
  3. 3The first surface opens. With .lazy, stages 1 to 3 run now, on the main thread, followed by the mount. With .eager, only the mount is left.
  4. 4The surface is live. Each stage reports its duration, so you can measure the real cost on your devices before choosing.
  5. 5A second surface opens. The runtime is shared. Under both policies only stage 4 runs.
  1. createHermes creates the JavaScript runtime.
  2. prepareBytecode checks the bundle exists and prepares it. On Android this stage is merged into the next one.
  3. evaluate runs the framework and your React project. Surfaces register here.
  4. mount renders one surface into its native container, until React has rendered it for the first time.

The board compares .lazy and .eager. A third policy, .idle, exists and today behaves exactly as .lazy (see BootPolicy).