Frameworks

React interview questions

Beta

Rendering, hooks, state, effects, performance and the mental model behind them.

80 questions · 40 theory · 40 codingWorks best after JavaScript

Subtopics

  • Components, props & JSX8
  • State & useState6
  • Effects & useEffect6
  • Rendering & reconciliation6
  • Keys & lists6
  • Context & prop drilling6
  • useMemo, useCallback & memo6
  • useRef & DOM access6
  • Custom hooks6
  • Forms & controlled inputs6
  • Data fetching & suspense6
  • Error boundaries6
  • Testing with React Testing Library6

Sample questions

  • CodingJuniorComponents, props & JSX

    Write mergeDefaultProps(props, defaults). It returns a new plain object that has every key from defaults, overridden by any key present in props whose value is not undefined. Neither input object should be mutated. This is the logic behind default props: a caller who does not

  • CodingJuniorComponents, props & JSX

    Write buildClassName(base, conditional). base is a string (possibly with several space-separated classes). conditional is an object mapping class name to a boolean. Return a single space-separated class string containing base's classes followed by every key of conditional whose

  • TheoryJuniorComponents, props & JSX

    In plain terms: what is a React component, and what are props? Give me a concrete example of a parent handing something to a child.

  • TheoryJuniorComponents, props & JSX

    You write <Card title="Hi">text</Card> in a .jsx file. What does that line actually turn into when the code runs, and why does a component have to return a single root node?

  • CodingJuniorContext & prop drilling

    Write composeProviderValues(values). values is an array of plain objects, representing a stack of nested Context.Provider values from outermost to innermost. Merge them into the single object a component deep in the tree would end up seeing if each provider spread the outer

  • TheoryJuniorContext & prop drilling

    In plain terms: what is "prop drilling", and how does React Context give you a way around it?