What is client state?
I know, by now, you must be thinking, when is this book going to start React Querying? We are almost there, I promise you. I just need you to fully understand why I love React Query so much and to do so, it is important to understand the main problem it solves.
Now, client state is not one of the problems it solves, but you must be able to identify client state in your day-to-day life as a developer so that you fully understand what should be managed by React Query and what should be managed by other state management tools.
Client state is the state that is owned by your application.
Here are a couple of things that help define your client state:
- This state is synchronous, which means you can access it without any waiting time and by using synchronous APIs.
- It is local; therefore, it only exists in your application.
- It is temporary, so it may get lost upon a page reload and is generally non-persistent between sessions.
With this...