React·100 questions

How does React.lazy and code splitting work?

Answer
React.lazy loads component dynamically.
Use with <Suspense fallback>.
Split by routes/heavy widgets.
Don't split too finely — many chunks are harmful.
Enable analysis in bundler (bundle analyzer).
Was this answer helpful?

More questions in this topic

Related questions from other topics