我是 react js 的初学者并收到以下警告,请帮助我修复/理解这个问题,这样的警告会导致性能问题吗?
==>node_modulesReactlibwarning.js:37
Warning: Don't set the props property of the component. Mutate the existing props object instead.
道
具应该是不可变的。如果要更改组件的值,请改用状态。
如果你做这样的事情,React 会对你大喊大叫。
var c = <Component />
c.props.foo = x; // bad
c.props.bar = y; // also bad
而是做
var c = <Component foo="x" bar="y" />
在此处阅读更多来自 ReactJS 文档的内容