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
This test case isn't caught by the lint rule. Note the use of React.memo and not React.useMemo. AFAIK, it is susceptible to reconciliation problems since UnstableNestedFunctionComponent is different on each render:
I'm working on a fix for this but wanted to flag in case I'm missing something.
Also, I wonder if the lint message can be improved to avoid this scenario. I think this happens because a dev sees the lint error, read the message saying to "memoize" the component, and accidentally mixes up React.memo and React.useMemo.
IMO it's still undesirable to use useMemo or useCallback here since the DOM subtree will be wiped if any of the hook dependencies change, so maybe the message shouldn't encourage this. But at the very least maybe we should clarify the message.
The text was updated successfully, but these errors were encountered:
This test case isn't caught by the lint rule. Note the use of
React.memo
and notReact.useMemo
. AFAIK, it is susceptible to reconciliation problems sinceUnstableNestedFunctionComponent
is different on each render:I'm working on a fix for this but wanted to flag in case I'm missing something.
Also, I wonder if the lint message can be improved to avoid this scenario. I think this happens because a dev sees the lint error, read the message saying to "memoize" the component, and accidentally mixes up
React.memo
andReact.useMemo
.IMO it's still undesirable to use
useMemo
oruseCallback
here since the DOM subtree will be wiped if any of the hook dependencies change, so maybe the message shouldn't encourage this. But at the very least maybe we should clarify the message.The text was updated successfully, but these errors were encountered: