我正在使用 reactjs,并且在componentDidUpdate()
. 但是当更新状态时,componentDidUpdate()
将被执行并且对象将重复语句
ps: const barrage = new Barrage(); the object will be execute repeatly
componentDidUpdate() {
const barrage = new Barrage();
}
const barrage = new Barrage();
如何避免Object语句重复执行