-
Notifications
You must be signed in to change notification settings - Fork 386
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
fix/rerenders: useMemo to avoid unnecessary rerenders #945
Conversation
@stavros-liaskos is attempting to deploy a commit to the Auth0 Team on Vercel. A member of the Team first needs to authorize it. |
Thanks for your contribution @stavros-liaskos! Could you remove |
13e95c6
to
4f4c79c
Compare
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 @stavros-liaskos
Thank you @adamjmcgrath |
📋 Changes
useContext
is triggering unnecessary re-renders. WithuseMemo
this can be avoided as described here.tl;tr
I noticed this when I integrated why-did-you-render to release-raccoon. Atm it is using 2 contexts, I implemented the above fix to ThemeProvider and this PR takes care of fixing this in
useUser
too.📎 References
🎯 Testing
Clicking on the
Home
btn calls the hook again but returns same results different objects that are equal by value.