Company
Date Published
Author
swyx
Word count
1371
Language
English
Hacker News points
None

Summary

React's Suspense feature is a generic way for components to suspend rendering while they load data from a cache, allowing for more control over where and when to show placeholders for slow connections. To try out React Suspense, developers can use Netlify Functions, which provides a deployable serverless backend alongside the local frontend dev server, eliminating the need to fake a backend API or deal with restrictive API keys. By modifying a create-react-app-lambda boilerplate and using the `react-cache` library, developers can set up a locally running frontend and backend to test React Suspense, creating resources that suspend rendering until data is available, and handling loading states with a fallback UI. Once deployed on Netlify, the app can be easily updated together with the client-side changes through Atomic Deploys.