Skip to content

Function: useDashboard() ​

ts
function useDashboard<T>(options): 
  | Dashboard<FieldOf<T>>
  | null;

Defined in: packages/react/src/dashboard.ts:14

Create a dashboard for the lifetime of a component. Returns null until the engine has loaded the data, and always while rendering on the server.

The dashboard is created once and recreated only when options.data or options.engine changes (by identity), so keep the data in state, a memo or a module constant. The other options are read when it is created. Creation waits one microtask, so a StrictMode mount, unmount and mount starts exactly one engine (and one worker). The dashboard is destroyed on unmount. A failure to load is thrown during render, for an error boundary to catch.

Type Parameters ​

Type Parameter
T extends Row

Parameters ​

ParameterType
optionsDashboardOptions<T>

Returns ​

| Dashboard<FieldOf<T>> | null

Released under the MIT License.