Skip to content

raf-query is early. The API can still change between minor releases, so use it at your own risk.

raf-query

Project

Credits

raf-query builds on the design of TanStack Query, and on React, Effect and TanStack Router.

TanStack Query

raf-query's cache follows the design of TanStack Query, by Tanner Linsley and the TanStack team. Query keys and their hashing, staleTime and gcTime, structural sharing, deduplication, retries with backoff, window focus refetching, infinite queries and streaming SSR hydration all come from there, and so do many of the ideas, and much of the structure, in these docs.

If you're choosing between the two: TanStack Query is mature, supports every major framework, and has a far larger ecosystem. raf-query is an experiment in a narrower question, what that cache looks like when queries start in loaders and server components and components only read them. See Comparison.

TanStack Query is MIT licensed, © Tanner Linsley.

Built with

  • React: use(), Suspense, transitions, actions and Server Components are what make render-as-you-fetch practical.
  • Effect: the cache is written in it.
  • TanStack Router and Start: the first integration, and what these docs run on.
  • Next.js: the React Server Components integration.

These docs

This site is a TanStack Start app that loads its own pages with raf-query: each page is a query with staleTime: Infinity, preloaded when you hover a link. Pages are markdown, compiled at build time with unified and highlighted with Shiki. The UI is built with shadcn/ui components and Tailwind CSS.

The demos run against a pretend server inside the page, so they work offline and you can change its latency and make it fail.

License

raf-query is MIT licensed.