-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] memoize context values for react/jsx-no-constructed-context-values #34849
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this!
if (disabled && focused) { | ||
// NOTE: Setting state during render? | ||
setFocused(false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this should be in a useEffect. Good catch.
if (disabled && focused) { | |
// NOTE: Setting state during render? | |
setFocused(false); | |
} | |
React.useEffect(() => { | |
if (disabled && focused) { | |
setFocused(false); | |
} | |
}, [disabled, focused]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a separate PR #34916
Memoize context values to satisfy eslint for #34642
Together with #34846 this concludes most fixes for: #34642