How does React decide what to re-render, and how would you avoid unnecessary renders?
7 /10
What to improve
Clear on what triggers a render and a good instinct on keeping state local. Mention that React compares the new and old trees and only updates the DOM where they differ, and say when memoising isn't worth it: it has a cost of its own.
A strong answer looks like
React re-renders a component when its state, props or context change, then reconciles the result against the previous tree and commits only the differences to the DOM. Keep state close to where it's used, split context by how often it changes, and memoise only components that are expensive and receive stable props.