---
description: Data Strategy
---

# Immer

{% 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 %}
