API/useQubee()
useQubee()
hooksrc/hooks/use-qubee.ts1 parameter
Give a component a qubee instance of its own, and re-render it whenever the query changes.
For lists whose state lives in memory — a dialog, a picker, an app without routing. The
instance is created once, on the first render; later changes to config are ignored, so
remount the component with a key to switch drivers. To share one instance between
components, use QubeeProvider.
Import
Section titled “Import”import { useQubee } from '@qubeejs/react';Signature
Section titled “Signature”function useQubee(config: QubeeConfig): QubeeHandleParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
config |
QubeeConfig |
The driver, plus an optional base URL, wire-level pagination mode (only PostgREST honours it) and request/response key overrides |
Returns
Section titled “Returns”The builder, paginator and store, plus the store’s current state
Example
Section titled “Example”function ArticlePicker(): ReactElement { const { builder, state } = useQubee({ driver: STRAPI_DRIVER });
return <button onClick={() => builder.nextPage()}>Page {state.page}</button>;}