React Interview Playbook · Chapter 12 of 12

React UI coding checklist

React UI coding rounds (sometimes called "machine coding") ask you to build a working component or mini-app in 45–90 minutes: an autocomplete, a kanban board, a paginated table, a nested comments widget. These rounds reward a repeatable process more than cleverness. This chapter gives you that process and a checklist to rehearse with.

The 45-minute timeline

MinutesPhaseOutput
0–5ClarifyWritten requirements and assumptions
5–10DesignState shape, component tree, data flow
10–30Build the coreWorking happy path
30–38Edge cases and statesLoading, empty, error, boundaries
38–43Accessibility and polishKeyboard, ARIA, focus, basic styling
43–45Wrap-upWhat's left, how you'd test, what you'd improve

For 60–90 minute rounds, stretch the build phase and add tests or extensions.

Phase 1: clarify (write it down)

Questions to ask for nearly any component:

  • What are the inputs? Props, static data, or an API? Is there a mock endpoint?
  • What interactions matter most? Mouse, keyboard, touch?
  • Controlled or uncontrolled? Will it be reused (design-system quality) or is it a one-off?
  • How much data? (10 items vs 10,000 changes the approach.)
  • Any styling expectations, or is functional markup fine?
  • Which browsers or frameworks are allowed? Can I use libraries?

Put the answers in a comment at the top of the file.

Phase 2: design state before markup

Write the state shape first, in a comment or a type:

// Kanban board
type Card = { id: string; title: string };
type Column = { id: string; title: string; cardIds: string[] };
type BoardState = {
  cards: Record<string, Card>;     // normalized
  columns: Column[];
};
// Derived: card count per column (compute, don't store)
// Local UI: which card is being edited (in Card component)

State design rules:

  • Minimal: store only what can't be derived.
  • Normalized when items are referenced from several places or move between lists.
  • Colocated: UI-only state lives in the component that uses it.
  • Explicit status: use 'idle' | 'loading' | 'error' | 'success' rather than several booleans.
  • Stable ids for every list item, used as keys.

Sketch the component tree:

Board
├── Column (×n)
│   ├── CardItem (×m)
│   └── AddCardForm
└── AddColumnButton

Phase 3: build the core

  • Static markup first with correct semantic elements. Then wire up state.
  • Get something on screen quickly. Rendered output builds confidence and gives the interviewer something to react to.
  • Narrate: "I'm putting the reducer at the board level because cards move between columns."
  • Use a reducer when several actions touch the same state:
type Action =
  | { type: 'addCard'; columnId: string; title: string }
  | { type: 'moveCard'; cardId: string; from: string; to: string; index: number }
  | { type: 'deleteCard'; cardId: string; columnId: string };

function reducer(state: BoardState, action: Action): BoardState {
  switch (action.type) {
    case 'addCard': {
      const id = crypto.randomUUID();
      return {
        cards: { ...state.cards, [id]: { id, title: action.title } },
        columns: state.columns.map((c) =>
          c.id === action.columnId ? { ...c, cardIds: [...c.cardIds, id] } : c
        ),
      };
    }
    case 'moveCard': {
      const columns = state.columns.map((c) => {
        if (c.id === action.from) c = { ...c, cardIds: c.cardIds.filter((id) => id !== action.cardId) };
        if (c.id === action.to) {
          const ids = [...c.cardIds];
          ids.splice(action.index, 0, action.cardId);
          c = { ...c, cardIds: ids };
        }
        return c;
      });
      return { ...state, columns };
    }
    case 'deleteCard': {
      const { [action.cardId]: _removed, ...cards } = state.cards;
      return {
        cards,
        columns: state.columns.map((c) =>
          c.id === action.columnId ? { ...c, cardIds: c.cardIds.filter((id) => id !== action.cardId) } : c
        ),
      };
    }
  }
}
  • Immutable updates only. Never mutate arrays or objects in state.

Phase 4: edge cases and states

Go through this list out loud:

CategoryChecks
EmptyNo items, empty search results, empty input submitted
LoadingInitial load, subsequent loads (keep showing old data), button pending states
ErrorNetwork failure, non-2xx response, retry option
BoundariesFirst and last item in navigation, pagination limits, max lengths
Rapid inputDebounce, cancel stale requests, double clicks on submit
Async lifecycleComponent unmounts while a request is pending; parameters change mid-request
DataDuplicates, very long strings, special characters, unicode

Phase 5: accessibility

Interviewers increasingly treat this as required, not optional.

  • Semantic elements: button for actions, a for navigation, lists for lists, form/label for inputs
  • Everything works with the keyboard: Tab order, Enter/Space on custom controls, Escape closes overlays
  • Visible focus styles (don't remove outlines without a replacement)
  • Use the matching ARIA pattern for complex widgets:
WidgetKey ARIA
Tabsrole="tablist", tab, tabpanel, aria-selected, arrow-key navigation
Modal dialog<dialog> or role="dialog" + aria-modal, aria-labelledby, focus trap, focus return
Autocompleterole="combobox", aria-expanded, aria-controls, aria-activedescendant, role="listbox"/option
AccordionButton with aria-expanded and aria-controls
Toastrole="status" (polite) or role="alert" (assertive)
Togglearia-pressed or a checkbox/switch role
  • Images have alt; icon-only buttons have aria-label
  • Dynamic updates are announced (live regions) where useful
  • Focus is managed after actions (opening a dialog, deleting an item, changing step)

Phase 6: hooks hygiene

  • Every effect has a clear external-system purpose, and derived data is computed instead
  • Every subscription, timer, and listener has cleanup
  • Fetches abort or ignore stale responses
  • Functional updates where the next state depends on the previous one
  • Dependency arrays are complete (no suppressed lint rules)
  • No components defined inside other components
  • Keys are stable ids, not indexes, for dynamic lists

Phase 7: performance (mention, implement only if needed)

  • Debounce search inputs (~200–300 ms).
  • Virtualize lists of hundreds or thousands of rows.
  • Memoize expensive derived data (useMemo) and memoize rows only if profiling shows a problem.
  • Lazy-load heavy subcomponents.

Wrap-up script

"The core flows work: adding, moving, and deleting cards. I handled empty columns and long titles. Keyboard users can move cards with the menu, though I didn't finish drag-and-drop announcements. With more time I'd add those live-region messages, persist the board to localStorage, write RTL tests for the reducer and the add-card flow, and extract the column into a memoized component if boards get large."

This shows self-awareness, prioritization, and a plan, which is especially valuable if you didn't finish everything.

Common question bank to practice

ComponentKey challenges
AutocompleteDebounce, race conditions, keyboard nav, combobox ARIA, caching
ModalPortal, focus trap/return, scroll lock, Escape, <dialog>
Tabs / AccordionCompound components, keyboard patterns
Data tableSort, filter, pagination, selection, virtualization
Infinite scroll feedIntersectionObserver, loading states, dedupe
Nested comments / file treeRecursion, normalized data, expand/collapse, tree ARIA
Star ratingHover vs selected state, radio-group semantics
Todo with filtersDerived lists, URL state for the filter, persistence
Stopwatch / countdownIntervals, drift (use timestamps), cleanup
Multi-step formValidation per step, state persistence, focus management
Image carouselAutoplay with pause, keyboard, reduced motion, lazy images
Kanban boardNormalized state, moving between lists, drag-and-drop a11y

Final checklist

  • Requirements and assumptions written at the top
  • State shape designed before markup; minimal and normalized where needed
  • Happy path working by about 60% of the time
  • Loading, empty, and error states
  • Edge cases covered or explicitly mentioned
  • Semantic HTML, keyboard support, focus management, ARIA pattern
  • Effects cleaned up; no stale closures; stable keys
  • Spoken summary with next steps and a testing plan

Spotted a mistake or a rights concern? Report an issue