1.Reducer1(themeColor.js)
// reducer 优化后================
// 建议使用这中结构
// 1.定义默认数据
let initialState = {
themeColor: 'red'
}
// 2.Reducer
const themeReducer = (state = initialState, action) => {
switch (action.type) {
case 'CHANGE_COLOR':
return { ...state, themeColor: action.themeColor }
default:
return state
}
}
// 3.导出
export default themeReducer;
2.Reducer2(aa.js)
// reducer 优化后================
// 建议使用这中结构
// 1.定义默认数据
let initialState = {
aa:'99999'
}
// 2.Reducer
const aaReducer = (state = initialState, action) => {
switch (action.type) {
case 'CHANGE_AA':
return { ..