blob: 72ab478ae11c010ea8e95ff45608069bf527dfaa (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { getRoot, IStateTreeNode } from 'mobx-state-tree'
import { RootStoreModel } from '../root-store/root-store'
/**
* Adds a rootStore property to the node for a convenient
* and strongly typed way for stores to access other stores.
*/
export const withRootStore = (self: IStateTreeNode) => ({
views: {
/**
* The root store.
*/
get rootStore() {
return getRoot<typeof RootStoreModel>(self)
},
},
})
|