我使用的是reactjs,在componentDidUpdate()中有一个实例化。但当更新状态时,componentDidUpdate()将被执行,对象将重复语句 ps: const barrage = new Barrage(); the object will be executerepeatly
const barrage = new Barrage();
const barrage = new Barrage(); 如何避免Ob
componentDidUpdate() { clearInterval(this.intervalDurationThis can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate
在我的组件中,我使用componentDidUpdate检查userLoggedIn是否为真,如果是,我将重定向到“主”页面。componentDidUpdate(){ if (this.props.people.userLoggedIn我检查了日志,发现仍在从注册页面调用componentDidUpdate。
因此,我有点困惑,为什么还在调用co