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
The docs don't seem to forbid this behavior ("Calling this.setState() generally doesn’t trigger UNSAFE_componentWillReceiveProps()."), so I'm not sure this is technically a bug.
However, it does cause older code that doesn't yet use the reducer syntax for setState to stop working when wrapped in forwardRef. It caused a few headscratchers for me while refactoring old code, so I'm reporting it just in case.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
This appears in 16.3.2. Given that it is specific to forwardRef, it shouldn't apply to older versions.
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When inside of a
forwardRef
, callingsetState
causescomponentWillReceiveProps
to be called after thesetState
has completed.See https://codesandbox.io/s/n59k2v25r0 for demo
What is the expected behavior?
The docs don't seem to forbid this behavior ("Calling this.setState() generally doesn’t trigger UNSAFE_componentWillReceiveProps()."), so I'm not sure this is technically a bug.
However, it does cause older code that doesn't yet use the reducer syntax for
setState
to stop working when wrapped inforwardRef
. It caused a few headscratchers for me while refactoring old code, so I'm reporting it just in case.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
This appears in 16.3.2. Given that it is specific to forwardRef, it shouldn't apply to older versions.
The text was updated successfully, but these errors were encountered: