React data hook with pluggable strategies.
- The official Suspense for data fetching is experimental at this moment
- What's left is to use similar libraries (strategies) like
SWR
orreact-async
- Build a general data hook
- Integrate any library (strategy) like:
SWR
react-async
- and more
No matter the strategy used the hook should always work the same way and return the same params.
- Returns default data while real data is loaded from the API
- Returns errors, if there are any
- Returns the data once loaded from the API
Gives you the data hook with a few strategies implemented (see them in /src/hooks/useData
) and the test components associated to every strategy. (in src/components
)
- Copy the
src/hooks
folder into your app - Create your own strategy or use an existing one. Remove all others.
See the hook docs for details.