import { combineReducers } from 'redux';import {ADD_TO_CART,CHECKOUT_CART,INITIALIZATION} from '../actions/action.jsx';import { List, Map , toJS } from 'immutable';const products = List([]);const initializateReducer = (state=products ,action) =>{ if(!action.products){ return state; } switch(action.type){ case INITIALIZATION : for(let i=0; i< action.products.length;i++){ state.push(Map(action.products[i])); //push不进去????!!! } return state; default: return state; }};
1 回答
慕田峪9158850
TA贡献1794条经验 获得超7个赞
const initializateReducer = (state={} ,action) =>{
if(!action.products){ return state; } switch(action.type){ case INITIALIZATION : return {products:List(action.products)}; default: return state; }
};
添加回答
举报
0/150
提交
取消