Local vs global state
global storelocal component state
Local = owned by one component; global = shared app-wide (cart, user, theme).
Say: "Keep this local, but put the user in global state."
Lifting state up
Parent ← state lives here
├ ChildA
└ ChildB
Moving shared state to the closest common parent so siblings can both use it.
Say: "Lift the selected state up to the parent."
Prop drilling
A → B → C → D
passing props all the way down
Passing data through many layers of components, a smell that often calls for context/store.
Say: "This is prop-drilling, use context instead."
Context / provider
<ThemeProvider>
// any child can read theme
</ThemeProvider>
A way to share values with a subtree without passing props at every level.
Say: "Provide the theme via context."
Store / state management
store→view
A central place for app-wide state (Redux, Zustand, Pinia) with predictable updates.
Say: "Manage cart state in a global store."
Derived / computed state
const total = items.reduce(...)
// computed, not stored
Values calculated from existing state rather than stored separately (avoids drift).
Say: "Compute the total, don't store it in state."
Side effect
useEffect(() => {
// fetch, subscribe, timer
}, [dep])
Work outside rendering, fetching, subscriptions, timers, that runs after render.
Say: "Fetch data in an effect when the id changes."
Hook
useState · useEffect
useRef · useMemo
Reusable functions that add state/lifecycle/logic to components (React), start with use.
Say: "Extract this into a custom useFetch hook."
Controlled vs uncontrolled
<input value={v} onChange={..}/>
// controlled by state
Controlled inputs are driven by state; uncontrolled keep their own internal value.
Say: "Make the form inputs controlled."