> For the complete documentation index, see [llms.txt](https://vytautas.gitbook.io/ng-state/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vytautas.gitbook.io/ng-state/core-concepts/componentstate-decorator.md).

# @ComponentState decorator

When component is created `@ComponentState` decorator creates does two things:

* Creates instance of state actions
* Creates two `@Input` parameters: `statePath` and `stateIndex`

Component state takes 1 parameter but it can be either action class or function that resolves action class:

```typescript
@ComponentState(TodosStateActions)
```

or

```typescript
@ComponentState((component: TodosComponent) => {
  return component.isStateA
    ? A_StateActions
    : B_StateActions;
})
```
