Skip to content

brumm/homemade-suspense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Homemade Suspense

This is a toy implementation of Suspense using Error Boundaries. Do not use this in production!

This is using the github API to display a repositories' file tree. Data is fetched 'synchronously' inside the component, in a toy approximation of what the Suspense API is doing.

The idea is to use an ErrorBoundary show a loading state if we catch a promise that is being thrown further down the tree. The promise is thrown if data is not yet fetched (cache miss) and returned synchronously if data is already there (cache hit)

Check out HomemadeSuspense.js and cache.js to see the magic.

Note: you'll have to supply your own API token in resources.js

Image of a github file tree rendered with our toy suspense implementation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors