|src/
----|components/
----|store/
--------|index.js
--------|reducer.js
----index.js
// src/store/index.js
import { createStore } from 'redux' // 引入redux的createStore
import reducer from './reducer'
// 创建store
const store = createStore(reducer) // createStore()方法需要一个参数:reducer
// 抛出store
export default store
// src/store/reducer.js
let defaultState = {
inputValue: '',
lists: []
}
export default (state = defaultState, action)=>{
return state
};
网友评论