我正在试图弄清楚如何在redux中为商店设置初始状态.我使用https://github.com/reactjs/redux/blob/master/examples/todos-with-undo/reducers/index.js作为示例.我试图修改代码,以便todos初始化了一个值.
const todoApp = combineReducers({
todos,
visibilityFilter
}, {
todos: [{id:123, text:'hello', completed: false}]
})
Run Code Online (Sandbox Code Playgroud)
遵循文档:http://redux.js.org/docs/api/createStore.html
但它不起作用,我不太清楚为什么.