useDispatchDashboardCommand()
Hook that takes command creator and returns function that will result into dispatching this command.
useDispatchDashboardCommand: <TCommand extends DashboardCommands, TArgs extends any[]>(commandCreator: (...args: TArgs) => TCommand) => ((...args: TArgs) => void)
Parameters
Parameter | Type | Description |
|---|---|---|
commandCreator | (…args: TArgs) => TCommand | command factory |
Returns
((…args: TArgs) => void)
callback that dispatches the command
Remarks
The created function takes original command creators parameters as per example below.
Example
// create a dashboard command to reset AttributeFilter selection
const resetAttributeFilter = useDispatchDashboardCommand(resetAttributeFilterSelection);
// somewhere else in the code call the command to reset the filters
**
resetAttributeFilter(<dashboard-local-id>);
**