0
Challenge · 101Interview Prep

Frontend Coding Patterns

Interviewused in ~80% of apps

The live component-build interview is not a memory test — it is a pattern-matching test. Strong candidates do not invent a fresh solution under pressure; they recognise the prompt as one of a handful of patterns they have built a dozen times, and reach for the skeleton.

Core idea. Almost every "build me a component" prompt reduces to four reusable patterns — controlled input, list + filter, fetch + render, and compound component — plus two meta-moves: lifting state up and extracting a custom hook. Learn the skeletons cold so the interview becomes customisation, not invention.
Playground, this isn't a screenshot
THE FOUR PATTERNS BEHIND MOST COMPONENT-BUILD INTERVIEWS — PICK ONE
Controlled inputskeleton
function NameField() {
  const [name, setName] = useState("");
  return (
    <input
      value={name}                         // state -> UI
      onChange={(e) => setName(e.target.value)} // UI -> state
    />
  );
}

When to reach for it: Any form field: search box, login, settings. The UI must react to what was typed (validate, filter, enable a button).

The tell: Heard "build a form / make this input do X as you type" → state drives value, onChange writes it back.

Almost every "build me a component" prompt is one of these four — or two of them stacked (a list + filter that fetches, a compound component whose parts hold controlled inputs). Recognise the pattern, reach for the skeleton, then customise.

↑ play a little first, then dig in