Skip to content
API/@qubeejs/react

@qubeejs/react

@qubeejs/react — the hooks and the providers: lists whose state lives in the URL or in memory, the page they ask for fetched for you, and a query builder per component or per subtree.

Nothing from @qubeejs/core is re-exported: list definitions, params, drivers and the pagination helpers are imported from the core, and documented there.

Import from @qubeejs/react
Needs Nothing beyond the package and its two peers, react and @qubeejs/core.
Runs in Client components: the entry is marked 'use client'. A Server Component can render what it exports, not call it.
Export Kind What it is
<BrowserAdapter> component Make browser history the router adapter of every list below it — for apps without a router.
<MemoryAdapter> component Keep the query of every list below it in memory instead of the URL, and share it between them — the filters, the table and the pager of a list in a dialog.
<QubeeFetchProvider> component Set what performs the requests of every fetching hook below it — useQubeeQuery, and useQubeeSWR from the SWR entry.
<QubeeProvider> component Share one qubee instance with every component below it — the filters, the table and the pager of one list, as provideNgQubeeInstance() does in Angular.
useBrowserAdapter() hook A RouterAdapter for apps without a router:
useMemoryAdapter() hook A RouterAdapter that keeps a list’s query in memory instead of the URL — for a list in a dialog, a picker, or anywhere the page URL must not change.
useQubee() hook Give a component a qubee instance of its own, and re-render it whenever the query changes.
useQubeeContext() hook Read the nearest QubeeProvider’s instance, and re-render when its query changes.
useQubeeList() hook Drive a declared list:
useQubeeQuery() hook Fetch the page a request asks for, and fetch again when the request changes.
createAdapterProvider() function Make an adapter provider for a router this package ships no adapter for.
AdapterNavigateOptions type How RouterAdapter’s navigate should move to an href.
AdapterProviderProps type Props of an adapter provider:
ListSetOptions type Options of QubeeListHandle’s set.
MemoryAdapterProps type Props of MemoryAdapter.
QubeeFetcher type The function the fetching APIs call to perform a request.
QubeeFetchProviderProps type Props of QubeeFetchProvider.
QubeeHandle type What useQubee and useQubeeContext return:
QubeeListArgs type The arguments useQubeeList takes after the list:
QubeeListHandle type What useQubeeList returns for a list definition TList.
QubeeListRequest type The request of a QubeeListHandle:
QubeeProviderProps type Props of QubeeProvider:
QubeeQueryOptions type Options of useQubeeQuery.
QubeeQueryResult type What useQubeeQuery returns.
RouterAdapter type What useQubeeList needs from a router:
SortToggle type The toggleSort member of a QubeeListHandle:
MissingQubeeProviderError error Thrown by useQubeeContext when no QubeeProvider is above the calling component.
MissingRouterAdapterError error Thrown by useQubeeList when it has no router adapter:
QubeeFetchError error Thrown by fetchQubeePage — and reported by the hooks built on it — when the API answers with a status that is not ok.