AceDevHub
Beginner React Interview QuestionsBeginnerConcept

React · Question 13

What causes a React component to re-render?

Direct answer

A component can render initially and then render again when its state updates, when its parent renders it again, or when a context value it reads changes.

  • Local state update: a setter such as setCount can schedule a render.
  • Parent rendering: by default, rendered child components are evaluated again with the parent's current props.
  • Context update: components reading that context receive the new value and render again.

A React render does not automatically mean the DOM changes. React can render a component, compare the result, and commit no DOM update if nothing visible changed.