Skip to content
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

Only update state when values change #34

Open
OliverJAsh opened this issue Jun 23, 2020 · 0 comments · May be fixed by #36
Open

Only update state when values change #34

OliverJAsh opened this issue Jun 23, 2020 · 0 comments · May be fixed by #36

Comments

@OliverJAsh
Copy link

OliverJAsh commented Jun 23, 2020

Reduced test case: https://stackblitz.com/edit/react-9vjncm

Here we are logging the size every time its reference changes. The actual size never actually changes.

As you can see, this results in 4 logs:

image

I would only expect the first two to be logged, since the last two are duplicates—the size has not changed.

This could result in wasted re-renders.

@Sergio-Mira Sergio-Mira linked a pull request Feb 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant