Grokking React Advanced
Vote

0% completed

​

Query Keys and Caching

How does React Query know that two components asked for the same data, and how long does it keep that data before it asks the server again? Both answers come from the query key and from a few timing options. This lesson follows one cache entry from its first request until React Query deletes it.

The running example extends the posts app from the previous lesson. A Post component shows one post, and two buttons switch between post 1 and post 2.

The key names the data

A query key is an array that identifies one piece of server data in the cache

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content