Reducer中是不能直接修改state的,需要将原来的state拷贝一份副本出来给newState,那么实现的方案是什么呢?
方案一:
方案二:
const newState = Object.assign({}, state)
方案三:
const newState = {...state}
Reducer中是不能直接修改state的,需要将原来的state拷贝一份副本出来给newState,那么实现的方案是什么呢?
方案一:
方案二:
const newState = Object.assign({}, state)
方案三:
const newState = {...state}