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
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 }.
The text was updated successfully, but these errors were encountered:
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 }.
The text was updated successfully, but these errors were encountered: