Grokking React Advanced
0% completed
Loading Components with lazy and Suspense
const Dashboard = lazy(() => { console.log("load function called"); return import("./Dashboard.jsx"); }); console.log("lazy() has returned");
lazy() has returned
Calling lazy downloads nothing. It returns a component that knows how to load its code, and the loading starts only when React first tries to render that component. This lesson follows the dashboard of Acme Admin through that first render.
lazy: a component whose code arrives later
lazy comes from react and takes one argument, a load function
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%