Home
← All questions

Suspense and React.lazy code splitting

MediumPremiumReact

Asked at Meta · Netflix · Airbnb

React interview practice: Lazy-load routes and components with Suspense boundaries.

Answer

React.lazy dynamically imports a component (webpack/vite chunk). Suspense shows a fallback while the chunk loads (or while concurrent data suspends in frameworks like Relay/Next.js).

Pattern: wrap lazy routes in a boundary near the router; nest boundaries so one slow widget doesn't blank the whole page.

Premium question

Unlock the full model answer with Mentoxis Premium.

Unlock with Premium