Callbacks vs Lifting State Up
What you'll learn: When passing callback props signals that state should actually live in a parent component instead.
The Decision Point
You've learned to pass functions down as props so children can notify parents of events. But here's the moment where you need to step back: if multiple sibling components need to react to the same callback, that's a sign the state shouldn't be in one sibling—it should be lifted up to their shared parent.
The Pattern Recognition
Imagine two sibling components: a form input and a display panel. If the input passes a callback up to the parent just so the parent can pass data back down to the display panel, you're seeing the classic "lifting state up" signal.
The callback prop pattern works great when:
- One child notifies the parent
- The parent handles it internally
- No other components need that data
But when you find yourself passing callbacks that exist only to shuttle data between siblings, the state belongs higher in the tree.
The Analogy
Think of it like office communication. If two teammates constantly message each other through their manager, the manager should probably just coordinate that information directly. The callbacks are revealing where the "single source of truth" should actually live.
When to Lift
If you're writing a callback prop whose only job is to update state that another component needs to read, lift that state to the nearest common ancestor. Now both children can access it directly through props—no callback middleman needed.
Key Takeaway: Callback props that coordinate data between siblings are a sign to lift state to the parent—shared state lives where all consumers can reach it.