1.0.3 • Published 3 years ago

use-fetch-cache v1.0.3

Weekly downloads
26
License
MIT
Repository
github
Last release
3 years ago

Build Status

useFetchCache

This is just a wrapper around the useSWR hook that adds the initial data to the cache and fetches the data when there is no initial data available.

Why

When you use Server Side Rendering to render you page and provide initial data this data is not stored in the cache. That means that for the cache to work you need an extra client-side fetch, which will only add unnecessary load to the backend.

How to use

The signature is exactly the same as the current signature of useSWR.

Notes

If you don't provide initial data this hook will fetch the data for you on mount.

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago