React mistake: Declaring state too high


React mistake: Declaring state too high.

Why it's a problem:
🚫 Needless extra code
🚫 Needless extra renders
🚫 Needless complexity for no benefit

How to find it: A component declares state it doesn't read or set, and passes it down to one child.

Solution: Move state down.

View original on X