useDispatchDashboardCommand
Home > @gooddata/sdk-ui-dashboard > useDispatchDashboardCommand
useDispatchDashboardCommand variable
Hook that takes command creator and returns function that will result into dispatching this command.
Signature:
useDispatchDashboardCommand: <TCommand extends DashboardCommands, TArgs extends any[]>(commandCreator: (...args: TArgs) => TCommand) => (...args: TArgs) => void
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>);
**