Skip to main content

Store

The store is based on legend app state

The most you have to know is that every node of your store can be modified using set() and accessed using get().

Each service has a local state accessible from itself

type State = { count: number };

export class CounterService extends Service<State> {
static initialState: State = { count: 0 };

increment() {
this.state.count.set((count) => count + 1);
}
}

The global store is accessible using the instantiated Cortex object

const core = new Core()

const count = core.counter.count.get()

For further technical information you can refer to the official documentation