React & update state with props & Object.assign
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 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/11591797.html
未经授权禁止转载,违者必究!