April 2018
Beginner
536 pages
13h 21m
English
In this section, we are going to learn to use observables and actions. The following code snippet declares a Store named ActorStore:
import { ActorInterface } from "../../universal/entities/actor";
import * as mobx from "mobx";
import { provide } from "../config/ioc";
import { TYPE } from "../contants/types";
import * as interfaces from "../interfaces";
const { observable, action, runInAction, configure } = mobx;
configure({ enforceActions: true });
@provide(TYPE.ActorStore)
export class ActorStore implements interfaces.ActorStore {
The ActorStore is a class that is decorated with the @provide decorators. This decorator is used to allow us to inject the Store into other elements in the application.