Component Re-render
Question
What triggers a React component to re-render?
Hint
A component re-renders when its state or props change.
Explanation
A React component re-renders when: 1) its state changes (useState setter called with new value), 2) its parent re-renders (unless wrapped in React.memo with unchanged props), 3) a context it consumes changes. Note: calling a state setter with the same value (Object.is returns true) does NOT trigger a re-render. Parent re-renders cascade to children unless memoized. Context value changes re-render all consumers. Understanding re-render triggers is key to React performance optimization.
Related Resources
Related Lessons
- State
Learn state.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.