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

# Immer

Data Strategy

{% code title="todos.actions.ts" %}

```typescript
import { Store, HasStore, InjectStore } from "react-state-rxjs";
import { TodoModel } from "./todo.model";

@InjectStore('todos')
export class TodosStateActions extends HasStore<any> {

    addTodo(item: TodoModel) {
        this.store
            .update(state => {
                state.push(item);
            }, { message: 'Item Added' });
    }

    deleteTodo(index: number) {
        this.store.update(state => {
            if (index > -1) {
                state.splice(index, 1);
            }

            // delete state[index];
        });
    }

    clearTodos() {
        this.store.reset();
    }

    updateFirstItem() {
        this.store.select(['0']).update(state => {
            state.description = 'updated';
        });
    }

    reset() {
        this.store.reset();
    }

    get todosAsync(): any {
        return this.store.map(state => state);
    }
}
```

{% endcode %}
