我想知道如何在redux中设置商店的初始状态。我以https://github.com/reactjs/redux/blob/master/examples/todos-with-undo/reducers/index.js为例。我试图修改代码,以便todos初始化一个值。如何在redux中设置初始状态
const todoApp = combineReducers({
todos,
visibilityFilter
}, {
todos: [{id:123, text:'hello', completed: false}]
})
的文档以下内容:http://redux.js.org/docs/api/createStore.html
,但它不工作,我不明白为什么。
OP问:“我想知道如何设置一个商店的初始状态在REDX。” – ctrlplusb