# StateDef

the class StateDef holds the definition of a state, that can be passed to [Conan.state](/api/main-classes/conan.md)

| Params           |                                                                                                                                                                                                                         |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name             | <p><strong>Type:</strong>  <code>string </code><em><code>required</code></em></p><p>the name we want to use for this state</p>                                                                                          |
| initialData      | <p><strong>Type:</strong>  <code>AsapLike\<DATA> </code><em><code>required</code></em> </p><p> the initial data we want to have when the state is created</p>                                                           |
| reducers         | <p><strong>Type:</strong>  <code>ReducersFn\<DATA, REDUCERS> </code><em><code>optional</code></em></p><p>the reducers that will act on this state</p>                                                                   |
| actions          | <p><strong>Type:</strong>  <code>ActionsFn\<DATA, REDUCERS, IPartial\<ACTIONS>> </code><em><code>optional</code></em></p><p>the actions that will act on this state</p>                                                 |
| autoBind         | <p><strong>Type:</strong>  <code>any </code><em><code>optional</code></em></p><p>any object with logic we want to auto bind with this state</p>                                                                         |
| pipelineListener | <p><strong>Type:</strong>  <code>IConsumer\<FlowEvent> </code><em><code>optional</code></em></p><p><strong>TBC: Que mierdas es esto Alberto?</strong></p>                                                               |
| cancelAutoStart  | <p><strong>Type:</strong>  <code>boolean </code><em><code>optional</code></em></p><p>true if we want to cancel the auto start of the state</p>                                                                          |
| reactions        | <p><strong>Type:</strong>  <code>RUserReactionsDef<{ nextData: DATA }, 'nextData', { nextData: ACTIONS & REDUCERS }> </code><em><code>optional</code></em></p><p><strong>TBC: Que mierdas es esto Alberto?</strong></p> |
| nature           | <p><strong>Type:</strong>  <code>FlowEventNature </code><em><code>optional</code></em></p><p><strong>TBC: Que mierdas es esto Alberto?</strong></p>                                                                     |

|   |   |
| - | - |
|   |   |


---

# 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.conanjs.io/api/main-classes/conan/statedef.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.
