Interview Q&A / React
React interview questions
Rendering, state, hooks, keys and effects, explained with small examples.
Prefer rapid revision? Practise React short interview answers →
- What does it mean for a React component to be pure?
A pure component returns the same JSX for the same props, state and context, and changes nothing outside itself while rendering. Purity lets React re-run, skip or repeat renders safely, including in Strict Mode.
IntermediateQuick answer1 min read - Why must a reducer function be pure, and what breaks if it is not?
React may call a reducer more than once with the same inputs, for example in Strict Mode. A pure reducer returns a new state from state and action only. Mutating state or running side effects inside it gives wrong or duplicated results.
IntermediateQuick answer1 min read