Configuring React Query
React Query has a very fast and simple configuration. This improves the developer experience and can prepare you to start migrating your server state to React Query as soon as possible.
To add React Query to your application, there are only two things you need to know:
- QueryClient
- QueryClientProvider
QueryClient
As you should be aware right now, caching is one of the most important things React Query makes easier for developers. In React Query, there are two mechanisms used to handle this cache called QueryCache and MutationCache.
QueryCache
is responsible for storing all the data related to your queries. This can be the data of your query as well as its current state.
MutationCache
is responsible for storing all the data related to your mutations. This can be the data of your mutation as well as its current state.
To make it easier for a developer to abstract from both caches, React Query created QueryClient
. This is responsible...