State Management · Senior · Question 43 of 75
How do you stream slow, non-critical data from a React Router loader?
- ✓Correct answer: Return a promise (not awaited) and render it with
<Suspense>+<Await>oruse() - 2Split the loader into two routes
- 3Use
setTimeoutinside the component
Explanation
Await critical data, return the rest as a promise: return { product: await getProduct(), reviews: getReviews() }. The page renders immediately and reviews stream in.