Suspense for Data Fetching
Learn how Suspense extends beyond code splitting to coordinate loading states for asynchronous data, not just lazy-loaded components.
Beyond its original use with React.lazy for code splitting, Suspense can coordinate loading UI for any operation that 'suspends' — meaning it throws a promise that React catches and waits on before continuing to render that part of the tree. Data-fetching libraries and frameworks (React Query in experimental modes, Relay, and frameworks built around RSC like Next.js's App Router) integrate with this mechanism so that fetching data can show a <Suspense fallback> exactly like a lazily-loaded component would.
Suspense-based data fetching is like a restaurant putting up a single 'still preparing your table' sign that automatically comes down the moment every dish for that table is ready, instead of each individual plate at the table having its own separate 'still cooking' sticker that the kitchen staff have to remember to remove one by one.