> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# useDispatchDashboardCommand()

- Package: [@gooddata/sdk-ui-dashboard](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/index.md)
- Kind: function
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui-dashboard/src/model/react/useDispatchDashboardCommand.ts

Hook that takes command creator and returns function that will result into dispatching this command.

**Signature:**

```typescript
useDispatchDashboardCommand: <TCommand extends DashboardCommands, TArgs extends any[]>(commandCreator: (...args: TArgs) => TCommand) => ((...args: TArgs) => void)
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| commandCreator | (...args: TArgs) =&gt; TCommand | command factory |

**Returns:**

((...args: TArgs) =&gt; void)

callback that dispatches the command

## Remarks

The created function takes original command creators parameters as per example below.

## Example

```tsx
// 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>);
**
```
