Skip to content

Instantly share code, notes, and snippets.

@FreddyPoly
Created June 28, 2019 16:31
Show Gist options
  • Save FreddyPoly/2effbe07a1d1677a3c35250a77a9f469 to your computer and use it in GitHub Desktop.
Save FreddyPoly/2effbe07a1d1677a3c35250a77a9f469 to your computer and use it in GitHub Desktop.
[REACT NATIVE] Mobx root-store Example
import { Instance, SnapshotOut, types } from "mobx-state-tree"
import { NavigationStoreModel } from "../../navigation/navigation-store"
import { ApiStoreModel } from "../../services/api/api-store"
/**
* An RootStore model.
*/
export const RootStoreModel = types.model("RootStore").props({
navigationStore: types.optional(NavigationStoreModel, {}),
apiStore: types.optional(ApiStoreModel, {}),
})
/**
* The RootStore instance.
*/
export type RootStore = Instance<typeof RootStoreModel>
/**
* The data of an RootStore.
*/
export type RootStoreSnapshot = SnapshotOut<typeof RootStoreModel>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment