From ac49492e1746f7e7da629391080698a87d6afe02 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Wed, 5 May 2021 16:12:02 +1200 Subject: [PATCH] Weird mob X --- MobXLearning/mobx_course/src/stores/data/data-store.ts | 7 +++++++ MobXLearning/mobx_course/src/stores/data/todo-store.ts | 13 +++++++++++++ MobXLearning/mobx_course/src/stores/root-store.ts | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100644 MobXLearning/mobx_course/src/stores/data/data-store.ts create mode 100644 MobXLearning/mobx_course/src/stores/data/todo-store.ts create mode 100644 MobXLearning/mobx_course/src/stores/root-store.ts diff --git a/MobXLearning/mobx_course/src/stores/data/data-store.ts b/MobXLearning/mobx_course/src/stores/data/data-store.ts new file mode 100644 index 0000000..4f7e93b --- /dev/null +++ b/MobXLearning/mobx_course/src/stores/data/data-store.ts @@ -0,0 +1,7 @@ +export default class DataStore{ + todoStore: TodoStore; + + constructor(rootStore: RootStore){ + this.todoStore = new TodoStore(rootStore) + } +} \ No newline at end of file diff --git a/MobXLearning/mobx_course/src/stores/data/todo-store.ts b/MobXLearning/mobx_course/src/stores/data/todo-store.ts new file mode 100644 index 0000000..1a07fa8 --- /dev/null +++ b/MobXLearning/mobx_course/src/stores/data/todo-store.ts @@ -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; + } +} diff --git a/MobXLearning/mobx_course/src/stores/root-store.ts b/MobXLearning/mobx_course/src/stores/root-store.ts new file mode 100644 index 0000000..a284d31 --- /dev/null +++ b/MobXLearning/mobx_course/src/stores/root-store.ts @@ -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); + } +} \ No newline at end of file