Why an adapter?
@qubeejs/core does pure work. It turns a query into an API address, a response body into a page
of rows, and — since 1.3 — a page URL such as /articles?q=react&page=2 into typed state and back.
It never subscribes to anything, never navigates, and never performs a request.
A React app needs exactly those three effects. @qubeejs/react supplies them, and nothing else:
| You need | The adapter gives you |
|---|---|
| A list whose query lives in the page URL | useQubeeList() — reads the URL, writes it back one navigation at a time |
| Your router to be the one that navigates | An adapter provider for it — browser history, React Router, TanStack Router, the Next.js App Router — set once at the root, and createAdapterProvider() for any other |
| The page the list asks for | useQubeeQuery(), or the TanStack Query and SWR integrations; fetchQubeePage() on the server |
| The same list in a dialog, outside the URL | <MemoryAdapter> and useMemoryAdapter() |
| A component that drives the query builder itself | useQubee() — a qubee instance per component, read through useSyncExternalStore |
| Filters, a table and a pager sharing one builder | <QubeeProvider> and useQubeeContext() — one instance for a subtree |
Two ways to hold a query
Section titled “Two ways to hold a query”A declared list — you declare it once, with the core’s defineList, and useQubeeList gives
you typed state, a single set({ … }) for every change, and the request to fetch. Its state lives
in the address bar, so it survives a reload, can be shared as a link, and works with the back
button — or in memory, for a dialog or a picker, with the same code. Start with the
Quick start.
The builder — a component holds a qubee instance and drives it with the full builder API,
exactly as ng-qubee components do: builder.addFilter(…), builder.addSort(…),
builder.nextPage(). For queries assembled step by step, in ways a list definition does not
describe. Start with useQubee.
What it leaves to you
Section titled “What it leaves to you”- How requests are sent. The adapter fetches the page a list asks for — with a hook of its
own, or through TanStack Query or SWR — but what performs the request is
fetchor a fetcher of yours, so authentication stays in your code. See Fetching. - Routing. The adapter writes the URL through your router. It never registers routes or
renders links for you —
href()hands you the address, and your<a>or<Link>renders it. - The query language. Filters, operators, sorts, drivers and the list layer are the core’s, and
documented once, in the core docs ↗. The rule of thumb:
a symbol imported from
@qubeejs/coreis documented there; a symbol imported from@qubeejs/reactis documented here.
Which router?
Section titled “Which router?”The adapter works in any React app. Pick the page for yours — each ends with a working list page: Plain React, React Router, TanStack Router, Next.js.