👁 High-level Principles

1. The Store is a single object that contains the store state and serves as the “single source of truth.”

2. The only way to change the state is by calling setState() or one of the update methods based on it.

3. A component should NOT get data from the store directly but instead use a Query.

4. Asynchronous logic and update calls should be encapsulated in services and data services.

Let’s learn about Akita’s core concepts by creating the traditional Todo application.

🤓 Core Concepts

The Store

The basic store can contain any form of data that you want, but in most cases, you will prefer working with an entity store. You can think of an entity store as a table in a database where each row represents an entity.

Akita entity stores give you all the tools you need to manage your store easily, such as CRUD operations on entities, active entity management, error management, etc.

First, we must define the store’s interface. We extend the EntityState from Akita, providing it with the Todo entity type.

If you are curious, EntityState has the following signature: