Skip to content
API/useQubee()

useQubee()

hook
src/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 { useQubee } from '@qubeejs/react';
function useQubee(config: QubeeConfig): QubeeHandle
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

The builder, paginator and store, plus the store’s current state

function ArticlePicker(): ReactElement {
const { builder, state } = useQubee({ driver: STRAPI_DRIVER });
return <button onClick={() => builder.nextPage()}>Page {state.page}</button>;
}

QubeeHandle