> For the complete documentation index, see [llms.txt](https://docs.no-reducer.com/no-reducer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.no-reducer.com/no-reducer/no-reducer-actions/insert/insert-to-an-array-item.md).

# insert to an array item

This feature is designed for you if you have an array and wish to insert a state into a specific item within that array.

There are 2 optional parameters in case you want to insert the object to an item in an array \
*The **value*** of the item that we want to find \
*The **key*** of the value

```javascript
dispatch(insert('DESTINATION', 'OBJECT-NAME', PAYLOAD, VALUE, KEY )); 
```

**Example**: \
We want to insert `{ Nickname: ['Crawfish','Crawdad','Crayfish']}` to the item that has `id = 2` in the *`Users`* array. \
So the ***`value`*** is ***`2`*** and the ***`key`*** is ***`id`***.

```javascript
dispatch(insert('Users', "Nickname", ['Crawfish','Crawdad','Crayfish'], 2, 'id'));
```

<figure><img src="https://2096029297-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa8hQdsN7Pv00B1Pt9tuc%2Fuploads%2FUJEH34kQ2MEf59QNxder%2F68747470733a2f2f766e73656174746c652e636f6d2f64796e616d6963526564756365722f496e7365727457497468436f6e646974696f6e2e706e67.png?alt=media&amp;token=f86db183-bd51-4c7b-84c4-28da63d14e72" alt=""><figcaption></figcaption></figure>
