Select store inside store from the appState
Select store inside store from the appState
我有一家这样的店
{
rootStore: {
firstStore: {
el: false,
sec: false,
th: []
}
}
}
如何一次性获得第一家商店(使用一个select语句),现在我使用
() => (state: Observable<any>) => state.select('rootStore').select('firstStore');
你必须使用 map
:
() => (state: Observable<any>) => state.map(store => store.rootStore.firstStore);
作为替代方案,因为 select 基本上是 pluck
的别名,这也适用:
() => (state: Observable<any>) => state.select('rootStore', 'firstStore');
我有一家这样的店
{
rootStore: {
firstStore: {
el: false,
sec: false,
th: []
}
}
}
如何一次性获得第一家商店(使用一个select语句),现在我使用
() => (state: Observable<any>) => state.select('rootStore').select('firstStore');
你必须使用 map
:
() => (state: Observable<any>) => state.map(store => store.rootStore.firstStore);
作为替代方案,因为 select 基本上是 pluck
的别名,这也适用:
() => (state: Observable<any>) => state.select('rootStore', 'firstStore');