React & update state with props & Object.assign
Object.assign({}, oldObj, newObj)
https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
Object.assign(
previousState,
{quantity: state.quantity + 1},
{quantity: state.quantity + 1},
...
)
https://stackoverflow.com/questions/32414308/updating-state-on-props-change-in-react-form
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!