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
nothing enforces the correct usage of refs or able to inform about the incorrect ones
The expected behavior
StrictMode is capable of reporting refs being updated on every render
I've monkey-patched react code (markRefhere and here) to get informed about ref change and found a few changes that should not happen.
This a problem very hard to detect without a support from the platform, and my little experiment is incapable to understand the legacy of ref update, only the fact of such update.
The text was updated successfully, but these errors were encountered:
This is not technically incorrect code. Generally there should not be a need to store a DOM node in state.
Thanks for the idea but we don't have plans to add more to StrictMode at this time; I would recommend using a lint rule to prevent the patterns you mentioned if this is important for your project.
React version:
Steps To Reproduce
<div ref={(node) => setState(node)}/>
)Link to code example:
there are many different ways to create unstable ref:
createRef
instead ofuseRef
(happens)useCallback
The current behavior
The expected behavior
I've monkey-patched react code (
markRef
here and here) to get informed about ref change and found a few changes that should not happen.This a problem very hard to detect without a support from the platform, and my little experiment is incapable to understand the legacy of ref update, only the fact of such update.
The text was updated successfully, but these errors were encountered: