我已经学习ReactJS一段时间了。其中让我困惑的一件事是为什么ReactJS在许多方面(如props、元素等)使用不可变性。这背后是否有特定的原因?这背后的哲学是什么?
当我尝试向props添加新属性时,我会收到以下错误。
Uncaught TypeError: Can't add property me, object is not extensible
当我尝试向props添加新属性时,我会收到以下错误。
Uncaught TypeError: Can't add property me, object is not extensible