Last Updated: November 21, 2025
Query Keys
| Pattern | Meaning |
|---|---|
`['users']`
|
Collection of users |
`['users', id]`
|
Single user by id |
`['repo', owner, name]`
|
Repo metadata |
Hooks & Methods
useQuery(key, fetcher)
Read data with caching
useMutation(mutateFn)
Send edits with optimistic updates
queryClient.invalidateQueries()
Force refetch after mutation
Best Practices
Retry on transient failures, hydrate server data on the client, and use `isFetching` for loaders.
💡 Pro Tip:
Structure query keys hierarchically and rely on `staleTime` to avoid redundant refetches.