# Help with dispatch methods

**URL:** <https://jsonforms.discourse.group/t/help-with-dispatch-methods/1644>\
**Category:** General\
**Created:** [August 3, 2023, 2:19am UTC](https://jsonforms.discourse.group/t/help-with-dispatch-methods/1644 "2023-08-03T02:19:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bangank36](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/bangank36/32/764_2.png) [@bangank36](https://jsonforms.discourse.group/u/bangank36)\
**Post date:** [August 3, 2023, 2:19am UTC](https://jsonforms.discourse.group/t/help-with-dispatch-methods/1644/1 "2023-08-03T02:19:44Z")

</div>

Hi everyone,  
I am looking for solution to update the array data with jsonforms, so far I can only modify the array data using built in removeItem and addItem

Thanks

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [August 8, 2023, 10:02pm UTC](https://jsonforms.discourse.group/t/help-with-dispatch-methods/1644/2 "2023-08-08T22:02:06Z")

</div>

Hi @bangank36,

Internally we use a `useReducer` based state for the form-wide data. You can retrieve the dispatcher to this state via `useJsonForms()`. We have a number of actions which are supported. You can conveniently create them via “Actions.xyz”, e.g. `Actions.update(path, updater)`.

So for example to empty the array completely, you can execute:

```typescript
import { Actions } from '@jsonforms/core';
import { useJsonForms } from '@jsonforms/react';

// in the renderer code
const ctx = useJsonForms();
ctx.dispatch(Actions.update(path, () => []);

```

The `handleChange`, `removeItem` etc. functions are just convenience wrappers around this dispatch function.

// Edited the code example to be valid for React

---

<div class="post-metadata">

**Author:** ![chathuraa](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/chathuraa/32/698_2.png) [@chathuraa](https://jsonforms.discourse.group/u/chathuraa)\
**Post date:** [August 24, 2023, 1:17pm UTC](https://jsonforms.discourse.group/t/help-with-dispatch-methods/1644/3 "2023-08-24T13:17:57Z")

</div>

Hey @sdirix ,

When I try to use useDispatch, i get an error saying that there is no export.

Cheers,  
Chat.

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [August 28, 2023, 7:28am UTC](https://jsonforms.discourse.group/t/help-with-dispatch-methods/1644/4 "2023-08-28T07:28:57Z")

</div>

Hi @chathuraa,

You’re right I got this mixed up between our React and Vue bindings. In React you can access the dispatch method via `useJsonForms`, e.g.

```typescript
import { useJsonForms } from '@jsonforms/react';

const ctx = useJsonForms();
const dispatch = ctx.dispatch;

```
