react-addons-update這個套件legacy嘍,要做新專案可以改用immutability-helper
可以解決深淺拷𢭲的問題,這本書有寫一個應用例子:
ReactJS by Example – Building Modern Web Applications with React
const newState = update(this.state, {
selectBooks: { $splice: [[bookIndex, 1, books]] },
});