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

withBreakpoints returns new breakpoints object (with same data) every render. #27

Open
sandborg71 opened this issue Nov 29, 2018 · 1 comment

Comments

@sandborg71
Copy link

sandborg71 commented Nov 29, 2018

withBreakpoints returns new breakpoints object (with same data) every render.

We have a some child components that should not re-render every time the parent re-renders. But we noticed that they in fact do re-render and that the only reason is that the breakpoints object returned from withBreakpoints HOC is a new object each time. If we make our own copy of the breakpoints object and use that in our children components they do not re-render. The withBreakpoints HOC should of course return the same breakpoints object every time as this is "static" data. The object is equal to the other object but a new object, "===" gives false. Example breakpoints: { xxs: 0, xs: 375, s: 768, m: 1024, l: 1360, xl: 1920, xxl: 2048 }.

@filipjnc
Copy link

Has the issue been solved in the meantime? I'm hesitant to use this library fearing that my components will get unnecessarily re-rendered.

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

No branches or pull requests

2 participants