@empathyco/x-components
Version:
Empathy X Components
28 lines (16 loc) • 1.29 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [wireDispatch](./x-components.wiredispatch.md)
## wireDispatch() function
Creates a wire that dispatch an action to the store. This wire receives a function. This function is used to get the actual payload value passed to action. This wire can be used in every event, as it does not have a payload type associated.
**Signature:**
```typescript
export declare function wireDispatch<Payload>(action: string, payloadFactory: (params: PayloadFactoryData<Payload>) => any): AnyWire;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| action | string | The full action path to dispatch. I.e. <code>x/querySuggestions/fetchSuggestions</code>. |
| payloadFactory | (params: [PayloadFactoryData](./x-components.payloadfactorydata.md)<!-- --><Payload>) => any | A function that receives a [object](./x-components.payloadfactorydata.md) with the Store state, getters, payload and metadata as parameter. |
**Returns:**
[AnyWire](./x-components.anywire.md)
A [AnyWire](./x-components.anywire.md) wire that dispatches the action with the payload returned by the payloadFactory.