Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

PepijnSenders/react-query-next-ssg-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-query + next.js & SSG Example

This example uses react-query and next.js.

What's special?

This example uses SSG, meaning that basically every page is statically generated and could be served straight from the CDN. It also uses react-query's latest CacheProvider API's to be able to render the data statically at build time.

Some caveats

The SSR caching of react-query is not completely done yet. The progress to enable this is being tracked here. We can however already accomplish something similar by hydrating the cache manually trough the queryCache.setQueryData API.

We can use next.js's getStaticProps to get the props for the page. The caveat here is that we need to identify the props by supplying the same query key that we use for useQuery to hydrate the cache.

Releases

No releases published

Packages

No packages published