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
I don't have evidence that this is hurting us, but the React docs are quite clear that if building state depends on previous state then we should use the updater version instead of the object version. At the ReSub layer, we don't know if the derived class will need this should perhaps we should always opt-in to be safe?
Also, we could forbid using this.state for the previous state since the updater is given prevState (and props). Although that would involve changing the _buildState signature to forward it like the props.
One possible issue: how does the props argument correspond with nextProps in componentWillReceiveProps? Which should we use in there?
I don't have evidence that this is hurting us, but the React docs are quite clear that if building state depends on previous state then we should use the
updater
version instead of theobject
version. At the ReSub layer, we don't know if the derived class will need this should perhaps we should always opt-in to be safe?Also, we could forbid using
this.state
for the previous state since theupdater
is givenprevState
(andprops
). Although that would involve changing the_buildState
signature to forward it like theprops
.One possible issue: how does the
props
argument correspond withnextProps
incomponentWillReceiveProps
? Which should we use in there?https://reactjs.org/docs/react-component.html#setstate
The text was updated successfully, but these errors were encountered: