React tip: Keep state as "low" as possible


React tip: Keep state as "low" as possible.

Example: If state is just passed down to one child, it's too high.

Solution: Move the state down to the child.

Benefits:
✅ Avoids needlessly passing props
✅ Protects state from accidental changes
✅ Makes each component easier to understand
✅ Improves performance (avoids parent re-renders)

#react

Clarification: I’m not arguing for or against the container/presentation pattern.

If one were doing so, they’d have:

1. ContactFormContainer (contains the state)
2. ContactForm (just JSX).

Point is, the state doesn’t belong in App if only ContactForm uses it.

View original on X