Data fetching libraries
headquery works with data fetching libraries such as TanStack Query and SWR without an extra package. Two properties make this work:
- Deterministic URLs:
query.url()returns the same string for the same logical query, so it is a stable cache key. Two components that build the same query share one cache entry. - Immutable builders:
.page(n)or.limit(n)return a new query, so a base query can be reused for every page or variant without side effects.
Use the URL as the key rather than the query object: libraries compare keys by value, and the URL already contains everything that identifies the query.
Last updated on