How can I use React Suspense with an async local storage API to synchronously read stored values without causing re-renders?
I'm trying to use React.Suspense
to handle loading state when retrieving values from an async local storage API. The issue is that Suspense
is designed for data fetching, but local storage retrieval is usually synchronous or requires an effect.
Is there a clean way to wrap async local storage APIs inside a Suspense-compatible cache that avoids unnecessary re-renders and properly integrates with React’s rendering model?
I want to be able to synchronously read stored values while ensuring suspense-based fallback UI is shown while loading.