Tsallaka zuwa abun ciki
Justice Tech School

lazy and Suspense

lazy loads a component on demand and Suspense shows a fallback.

Example
const Chart = lazy(() => import("./Chart"));
function App() {
  return <Suspense fallback={<p>Loading</p>}><Chart /></Suspense>;
}

Exercise

Loading UI.

<Suspense ={<p>Wait</p>}>

Quiz Test

What does Suspense show while loading?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.