我在创建小型redux应用程序时遇到错误。错误类似于createstore未导出。不知道我错在哪里。请帮助或告诉我在哪里学习redux以获得最佳实践。
import {createstore} from 'redux';
import {composeWithDevTools} from 'redux-devtools-extension';
const initialState = {
todos : [
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
},
{
"userId": 1,
"id": 2,
"title": "quis ut nam facilis et officia qui",
"completed": false
},
{
"userId": 1,
"id": 3,
"title": "fugiat veniam minus",
"completed": false
}
]
}
const todoReducer = (state = initialState, action)=>{
switch(action.type){
default:
return state;
}
}
const store = createstore(todoReducer);
export default store;
是createStore
而不是createstore
。你的代码中有一个拼写错误。
import {createStore} from "redux"