export reducers = combineReducers ({
app: ...,
user: ...,
display:...,
})
//在配置文件中
const rootReducer = combineReducers ({
form: formReducer,
apollo: apolloReducer,
reducers
})
这导致状态树看起来像这样,
{
form: {...},
apollo: {...},
reducers: {
app: {...},
user: {...},
display: {...}
}
}
我想要这个...
{
form: {...},
apollo: {...},
app: {...},
user: {...},
display: {...}
}
我试过 ...reducers 但没有成功。提前致谢
最佳答案
你可以拥有一个包含所有 reducer 的对象,
export reducers = {
app: ...,
user: ...,
display:...,
}
然后你就可以
const rootReducer = combineReducers ({
form: formReducer,
apollo: apolloReducer,
...reducers
})
关于javascript - 组合组合 reducer ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48047038/