React Interview Questions

25 React interview questions with worked answers, complexity notes, and runnable code you can edit in the browser — ordered easy to hard so you build up steadily. Free, no signup. Open any question for the full answer.

The mental model behind the hooks

“What is a hook” gets you nowhere; the interview wants the model underneath. React works in phases: it renders (calls your components to produce a description of the UI), reconciles (diffs that description against the previous one), and commits (applies the minimal set of DOM changes). Effects run after commit, not during render, which is why you cannot read layout in the render body and why the dependency array matters so much. If you can narrate that cycle, most React questions decompose into “which phase is this about?”

Re-renders are the topic that separates comfort from mastery. A component re-renders when its state changes, when its parent re-renders, or when a context value it reads changes — and understanding this is how you diagnose the sluggish app. The fixes follow from referential identity: useMemo and useCallback preserve the identity of values and functions across renders so that memoized children and effect dependencies do not fire needlessly. Used without a reason, they are noise; used to stabilize a specific reference, they are the tool.

State management is a placement question before it is a library question: does this state belong local to a component, lifted to a shared parent, in context, in the URL, or on the server? Getting that right eliminates most of the problems a state library is brought in to solve. Increasingly, interviews add a machine-coding round — build a typeahead, a modal, a tabs component live — which tests whether you can turn this model into working code under time pressure. These questions build from the render model up to exactly that.

Easy

Medium

Hard

Other topics

HTML/CSS · Browser · JavaScript · TypeScript · System Design · Accessibility · Web Performance · Testing · Networking/Security · DSA

← Search all 265 questions