I am not super clear on the meaning of load here - does it mean loading into the memory or fetching over the network and load into the memory?
1 Answer
Code Splitting and Lazy Loading are techniques in React used to improve performance by optimizing how and when code is loaded.
- Code Splitting: This breaks down your application into smaller chunks that can be loaded on demand. It reduces the size of the initial JavaScript bundle by fetching code over the network as needed and loading it into memory when required.
- Lazy Loading: This delays the loading of components until they are
actually needed. It typically uses
React.lazy()for dynamic imports andReact.Suspenseto display a fallback during the load time.
Both techniques aim to enhance application performance by minimizing the initial load time and ensuring efficient resource usage. "Load" here involves both fetching code over the network and loading it into memory.