Best practices for defining using persistQueryClient with Next.js
A few parts to to this:
a) Where should you normally define a queryClient, outside of the one used inside the _app.js file's state for initialising the QueryClientProvider
b) Should I use persistQueryClientSave every time I want to perform a mutation on data that will then be persisted in the cache
c) Is it acceptable to have multiple queryClients in a file within the pages directory, particularly when using getStaticProps or getServerSideProps?
2 Replies
unwilling-turquoise•3y ago
a) as the docs for ssr say - inside the app component in state or an instance ref.
b) you should use the
PersistQueryClientProvider
c) sureextended-salmonOP•3y ago
thank you very much