@wpkernel/ui / createDataViewInteraction
Function: createDataViewInteraction()
ts
function createDataViewInteraction<TItem, TQuery, TActions>(options): DataViewInteractionResult<TItem, TQuery>;Creates a typed interactivity binding for a DataView controller.
Type Parameters
TItem
TItem
The resource record type handled by the DataView controller.
TQuery
TQuery
The query payload shape produced by the DataView controller.
TActions
TActions extends InteractionActionsRecord | undefined = InteractionActionsRecord
Optional interactivity actions map to augment the interaction.
Parameters
options
CreateDataViewInteractionOptions<TItem, TQuery, TActions>
Returns
DataViewInteractionResult<TItem, TQuery>
Example
ts
const runtime = createDataViewsRuntime({ namespace: 'acme/jobs' });
const interaction = createDataViewInteraction({
runtime,
feature: 'jobs-table',
resourceName: 'jobs',
});
const { store } = interaction;
// store.state.selection => []