老师,学习完immutable之后我又返回去修改了TodoList的demo。
在reducer中
const defaultState = fromJS({
inputValue: '',
list: []
})
export default (state = defaultState, action) => {
if (action.type === actionTypes.UPDATE_TODO_LIST) {
return state.merge({
list: state.get('list').push(fromJS("new")),
inputValue : fromJS('')
});
}
return state;
}
但是执行的过程中,浏览器会报错:index.js:20 Uncaught TypeError: Invalid attempt to spread non-iterable instance