While Data Loaders eliminate render waterfalls, they introduce a potential drawback:
loader function has finished resolving.Consider a course page:
If you await both queries in the loader:
The user clicks a course link and sits waiting for 1.8 seconds while the screen does nothing!
deferReact Router provides defer() (or streaming promises in modern versions).
You await the critical fast data, but do NOT await the slow data. You pass the unresolved Promise directly into the response:
<Suspense> and <Await>In your component:
<Suspense> and React Router's <Await> component, showing a fallback skeleton while the promise resolves in the background!<Await errorElement={...}> displays a localized error without breaking the main course view!resolve={...} on the <Await> component?awaited and which data should be deferred?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| React Router v6 Data Loaders and Actions | Protected Routes and Role-Based Access Guards |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.