You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a React v16 component, I defined componentWillReceiveProps inside which I always called setState (on an object with several members, including other objects). This seems to have caused a runaway loop of re-renders, because when I added code to make the call to setState conditional the loop was no longer observed. I thought calling setState in componentWillReceiveProps (and also componentWillMount) was not meant to trigger a re-render. Am I wrong? Has this changed in v16?
@theREALdebater This doesn't sound related to this issue, and no, setState in componentWillReceiveProps shouldn't trigger extra re-renders. Can you please file a new issue about this, with an example reproducing it?
See mailing list post, reproduced below for convenience:
The following reduced test case (jsfiddle) has an unnecessary reflow:
And a screenshot from the Timeline tab in Chrome Dev Tools showing the reflow:
An equivalent implementation (jsfiddle) not using
setState
incomponentWillReceiveProps
does not have the same reflow:The text was updated successfully, but these errors were encountered: