Query key

The array that names a query's data in the TanStack Query cache. Every input of the request belongs in it, so different inputs never share an entry, and a shared prefix such as ["orders"] lets one invalidation refresh a group of queries.

Minimal example

ts
queryKey: ["restaurants", near.lat, near.lng, near.radiusKm]

Learn this concept

Lesson 4.8 · TanStack Query caching

Used in exercises

Exercise 4.10 · Restaurant list screen Exercise 4.11 · Restaurant menu screen Exercise 4.15 · Item configurator screen Exercise 4.17 · Orders tab and order detail screens Exercise 4.22 · Restaurant search utilities
Prerequisite conceptsTanStack Query