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 React 17.0.2 adding a useEffect with empty clean up callback prevents the "state update on an unmounted component" warning
The expected behavior
In React 16, the warning is shown unless the clean up call back does work, for example by updating a guard "instance variable" in the vain of the "isMounted" scenario (as in https://stackoverflow.com/a/60907638).
I am not clear on what the current intention is, given #17925 and the fact that in 18.0.0-rc2 the state update is not performed after unmount in this example, with or without the empty destroy function.
The text was updated successfully, but these errors were encountered:
Adding a useEffect with an empty clean up callback prevents async "state update after unmount" warning in certain cases.
React version: 17.0.2
Steps To Reproduce
Link to code example:
https://codesandbox.io/s/spring-frog-9n59kj?file=/src/LoaderPage.jsx
The current behavior
In React 17.0.2 adding a useEffect with empty clean up callback prevents the "state update on an unmounted component" warning
The expected behavior
In React 16, the warning is shown unless the clean up call back does work, for example by updating a guard "instance variable" in the vain of the "isMounted" scenario (as in https://stackoverflow.com/a/60907638).
I am not clear on what the current intention is, given #17925 and the fact that in 18.0.0-rc2 the state update is not performed after unmount in this example, with or without the empty destroy function.
The text was updated successfully, but these errors were encountered: