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
When wrapping 'useCallback' to maintain a reference to 'effect', the return value of 'useRefEffect'. you use 'preservedCallback' created in 15L as a dependency.
But, the function used inside 'effect', which is the return value, uses 'callback', not 'preservedCallback'.
Is this intended behavior?
[ 1 ]
If you don't want to affect the 'effect' reference change due to the reference change of 'callback', use 'preservedCallback' in deps, but the actual operation is to use callback.
I'm wondering if I need to use 'preservedCallback' when using 'eslint-disable'.
slash/packages/react/react/src/hooks/useRefEffect.ts
Line 15 in 570759f
As you can see from the above code, you created a 'preservedCallback' using 'usePreservedCallback' to keep a reference to the 'callback'.
slash/packages/react/react/src/hooks/useRefEffect.ts
Line 32 in 570759f
When wrapping 'useCallback' to maintain a reference to 'effect', the return value of 'useRefEffect'. you use 'preservedCallback' created in 15L as a dependency.
slash/packages/react/react/src/hooks/useRefEffect.ts
Line 24 in 570759f
But, the function used inside 'effect', which is the return value, uses 'callback', not 'preservedCallback'.
Is this intended behavior?
[ 1 ]
If you don't want to affect the 'effect' reference change due to the reference change of 'callback', use 'preservedCallback' in deps, but the actual operation is to use callback.
I'm wondering if I need to use 'preservedCallback' when using 'eslint-disable'.
[ 2 ]
To avoid confusion in code
slash/packages/react/react/src/hooks/useRefEffect.ts
Line 24 in 570759f
I'm thinking that maybe I should use 'preservedCallback' instead of 'callback' in the above code.
The text was updated successfully, but these errors were encountered: