Browse Source

Weird mob X

master
James McKenzie 3 years ago
parent
commit
ac49492e17
3 changed files with 31 additions and 0 deletions
  1. +7
    -0
      MobXLearning/mobx_course/src/stores/data/data-store.ts
  2. +13
    -0
      MobXLearning/mobx_course/src/stores/data/todo-store.ts
  3. +11
    -0
      MobXLearning/mobx_course/src/stores/root-store.ts

+ 7
- 0
MobXLearning/mobx_course/src/stores/data/data-store.ts View File

@@ -0,0 +1,7 @@
export default class DataStore{
todoStore: TodoStore;

constructor(rootStore: RootStore){
this.todoStore = new TodoStore(rootStore)
}
}

+ 13
- 0
MobXLearning/mobx_course/src/stores/data/todo-store.ts View File

@@ -0,0 +1,13 @@
import { observable } from "mobx";

class Todo{}

export default class TodoStore {
@observable
list: Todo[];

private rootStore: RootStore;
constructor(rootStore: RootStore){
this.rootStore = rootStore;
}
}

+ 11
- 0
MobXLearning/mobx_course/src/stores/root-store.ts View File

@@ -0,0 +1,11 @@
import DataStore from "./data/data-store";

class RootStore{
dataStore: DataStore;
uiStore: UiStore;

constructor(){
this.dataStore = new DataStore(this);
this.uiStore = new UiStore(this);
}
}

Loading…
Cancel
Save