> 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/create.md).

# create

This function is used to create an object or an array inside of the root of states.&#x20;

Each object has a unique name; if there is a ***duplicated** name*, the object's value will be ***overridden***.

**Create an object**&#x20;

```javascript
dispatch(create('YOUR-OBJECT-NAME', { YOUR: 'OBJECT' }));
```

**Create an array**

```javascript
dispatch(create('YOUR-ARRAY-NAME', ['YOUR', 'ARRAY' ]));
```

**Example**\
I want to create an object named `User` from <https://jsonplaceholder.typicode.com/users/2>

```javascript
import { create } from "no-reducer";
...
const response = await axios.get('https://jsonplaceholder.typicode.com/users/2');
await dispatch(create('User', response.data));
```

<div align="left"><figure><img src="https://2096029297-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa8hQdsN7Pv00B1Pt9tuc%2Fuploads%2Fd1B3wRIIWkdacFhiQjbf%2F68747470733a2f2f766e73656174746c652e636f6d2f64796e616d6963526564756365722f437265617465644f626a65637455736572322e706e67.png?alt=media&amp;token=aa98ca54-48f9-4063-a8e0-1786c485c27f" alt=""><figcaption></figcaption></figure></div>
