javascript - react Cannot update during an existing state transition (such as within `render` or another component's constructor). Render methods should be a pure function of props and state;
2018-08-26T09:40:22Z||2018-08-26T09:40:22Z
完整的错误信息是:
Cannot update during an existing state transition (such as within render
or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to componentWillMount
.
然后就陷入了死循环,不停的error,界面卡死,卧槽真牛逼啊。
后来发现原来是一不小心在render里执行了一个函数,本来应该是:
onClick: () => this.handleEditClick()
写成了:
onClick: this.handleEditClick()