preloading
Starting to download code or data before it is needed, so it is ready by the time the user asks for it.
In more detail
Good moments are when the browser is idle or when the user shows intent, such as hovering over a button. Preloading too much wastes bandwidth.
Example
Calling a React.lazy import function early starts downloading the chunk; React reuses the same promise when the component renders.Related terms
- React.lazy — The React function that defines a component whose code is loaded with a dynamic import the first time it renders.
- requestIdleCallback — A function that schedules low-priority work to run when the browser has spare time at the end of a frame.
- chunk — One piece of a larger piece of data delivered by a stream.
Taught in
- Code-Splitting with React.lazy: Dynamic Imports And Chunks — React 19 & Modern Component Architecture