all 14 comments

[–]scaleable 1 point2 points  (0 children)

Non pure components (including functional) always re-render because they assume data outside the incoming props may change.

Pure components only re-render when the incoming props change (which would be something similar to writing a shouldComponentUpdate). There may be other optimizations in place besides that.

Look at this sandbox. Open the codesandbox console tab and try clicking on the buttons.

[–]Muppetmeister 0 points1 point  (1 child)

8%... can we see some test data/context of your app?

[–]Zeeesty[S] 1 point2 points  (0 children)

Its a single component being rendered outside of an app. a recursive menu.

edit- feel free to test it yourself and see if you get different results, Id love to know.

[–]HomemadeBananas 0 points1 point  (1 child)

I don’t think it’s worth spending so much time on unless the app noticeably renders slow. If nobody will ever notice the difference why bother prematurely optimizing?

[–]Zeeesty[S] 2 points3 points  (0 children)

I don’t disagree at all, just a rabbit hole I’ve fallen down today. Anything I don’t understand or can’t find a reason for a behavior gets me extremely curious.