无法阅读属性' removeAttribute' null使用Object.assign合并json对象时

时间:2017-11-16 07:39:23

标签: javascript json reactjs redux

嗨在我的reducer中我使用" Object.assign"合并两个对象。我得到了一个TypeError。我已经简化了用于理解目的的代码

内部减速器

case "UPDATE_ITEMS":
    let state = {title:'', id:''};
    let action = {assignmentItemList: ['item1', 'item2', 'item3']};
    let newObj = Object.assign({}, state, {assignmentItemList: action.assignmentItemList});

    return newObj;

在行动档案中。

export function getItemListSuccess (assignmentItemList) {
    return {type: types.GET_ASSIGNMENT_ITEM_LIST_SUCCESS, assignmentItemList};
}

内部thunk

//doing http call using fetch
try {
    dispatch(getItemListSuccess(response.items));
} catch(ex) {
    console.log(ex);
}

我作为回应得到了跟进。

TypeError: Cannot read property 'removeAttribute' of null
    at t.value (bundle.js:12)
    at r.notifyAll (react.min.js:12)
    at r.close (react.min.js:15)
    at r.closeAll (react.min.js:16)
    at r.perform (react.min.js:16)
    at o.perform (react.min.js:16)
    at o.perform (react.min.js:15)
    at Object.N [as flushBatchedUpdates] (react.min.js:15)
    at r.closeAll (react.min.js:16)
    at r.perform (react.min.js:16)

我想知道为什么会发生这种错误?

0 个答案:

没有答案