componentDidUpdate() { clearInterval(this.intervalDurationThis can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate
我使用的是reactjs,在componentDidUpdate()中有一个实例化。但当更新状态时,componentDidUpdate()将被执行,对象将重复语句 ps: const barrage = new Barrage(); the object will be executerepeatly
const barrage = new Barrage();
const barrage = new Barrage(
具有如下声明的组件:在MyComp componentDidUpdate中,我想知道state.form1.val1的前一个值是什么componentDidUpdate(prevProps, prevState) {
// compare current value of val1 with previous value
在我的组件中,我使用componentDidUpdate检查userLoggedIn是否为真,如果是,我将重定向到“主”页面。componentDidUpdate(){ if (this.props.people.userLoggedIn我检查了日志,发现仍在从注册页面调用componentDidUpdate。
因此,我有点困惑,为什么还在调用componentDi