React Core & Hooks (407 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)
What is suspense component?
junior LevelComponentsFormsPerformance
React Suspense is a built-in feature that lets you delay rendering part of the UI until asynchronous work (such as loading a component or fetching data) is ready. While waiting, React shows a fallback UI (loading text, skeleton, spinner, etc.) defined by the nearest <Suspense> boundary.
Common use cases:
- Code splitting with
React.lazy: Displays a fallback while the dynamic chunk script downloads. - Data fetching (with Suspense-enabled frameworks): Delays rendering until asynchronous server data is available.