# Nesting

As we know, ActiveJS doesn't have a single store, it has **storage** [Units](/activejs/fundamentals/units.md), hence instead of creating slices, we create groups.

When you need to combine multiple storage Units (or even other ActiveJS constructs) you can do that using the [Cluster](/activejs/fundamentals/cluster.md), to build a nested data structure, instead of storing deeply nested values in the Units.

### Combining Multiple Units to create a Meaningful Cluster

To do proper nesting and to make sure that you use ActiveJS Units as intended, you should try to keep the values of the Units flat, *i.e.: as less nested as possible.*

This would allow you to have clear and granular control over the state of your App. Updating and accessing the stored values would be much easier and efficient as well. For example:

```typescript
// instead of doing this
const store = new DictUnit({initialValue: {
  token: 'auth-token',
  userProfile: {...},
  userPreferences: {...}
}})

// do this
const tokenUnit = new StringUnit({initialValue: 'auth-token'})
const userProfileUnit = new DictUnit({initialValue: {...}})
const userPreferencesUnit = new DictUnit({initialValue: {...}})

const userDataCluster = new Cluster({
  tokenUnit, userProfileUnit, userPreferencesUnit // using shorthand notation
})
```

### Accessing and Observing not so nested values of the Unit

Even if you followed the above advice and kept your Units flat you might still want to create an even finer chunk of the information. For that purpose, you can create a [Selection](/activejs/utilities/selection.md) from a Unit's value.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.activejs.dev/activejs/guides/nesting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
