← Questions

React fundamentals and error handling

0
AppleCodingLast asked Feb 2026

A coding interview question asked in Apple's technical phone screen, last asked Feb 2026. It tests react, frontend and error handling.

A conversation about React, followed by how you deal with errors in a React app. Explain each point with a short code example where it helps.

Concepts to explain

  1. The virtual DOM and reconciliation: what happens when state changes, and why key matters in lists.
  2. Components, props and state: what triggers a re-render, and how to avoid unnecessary ones (memo, useMemo, useCallback).
  3. Hooks: the rules of hooks and why they exist, useEffect dependencies and cleanup.
  4. React 18 concurrent features: automatic batching, transitions (useTransition), Suspense.
  5. Server components versus client components: what runs where and what each can't do.

Error handling

  1. Error boundaries: what they catch, what they don't (event handlers, async code, server rendering), and where you place them.
  2. Errors in async work: failed requests, loading and error states, retries, and stale responses after a component unmounts.
  3. What the user sees when something breaks, and how errors are reported to monitoring.

Clarifying questions

  • Which React version and framework (plain React, Next.js) is the app on?
  • Should I write code, or explain and sketch?

What a strong answer covers

  • An accurate model of rendering: render and commit phases, when effects run.
  • Correct effect cleanup, for example cancelling a fetch with AbortController.
  • An error boundary written out (a class component with getDerivedStateFromError and componentDidCatch), and the async errors it cannot catch.
  • Concrete user-facing behaviour: a fallback UI, a retry button, keeping the rest of the page usable.

Follow-ups

  • A list re-renders slowly when one item changes. How do you find and fix it?
  • An effect runs twice in development. Why, and is it a bug?
  • How would you handle errors thrown inside a server component?

Where it's asked

  • Apple · Technical phone screen · Last asked Feb 2026

What it tests

react · frontend · error handling

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding