我想知道如何在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