▚ The Software Engineer's Field Manual
Chapter E16 · Primer + senior drill

Frontend Design for Angular & React — Architecture and Craft

"A frontend fails in two directions. It can be badly built — slow, tangled, impossible to change. Or it can be built beautifully and still be unusable, ugly or unreadable. This chapter covers both, because the same person is asked about both."

175 questions · answers collapsed Both halves: system design and visual craft Angular 22 & React 19 · compared honestly, side by side

01 · Why this chapter existsThe Two Ways a Frontend Fails, and the One Person Asked About Both

This chapter covers frontend architecture — how a large interface is structured, rendered and kept fast — and frontend craft — how it is spaced, typed, coloured and made usable. Both halves are written for Angular and React together, because the decisions are the same and only the syntax differs.

Field report · A senior frontend loop, two rounds on the same day

"In the morning round I ask them to design a product listing page for ten million items. Most candidates do well. They know about virtualisation, server-side filtering, caching, code splitting.

Then in the afternoon I show them two versions of a card component, identical in code, different in spacing and type, and I ask which is better and why.

And it falls apart. 'The second one looks cleaner.' Why? 'It just does.' They have built interfaces for nine years and have no vocabulary for what makes one work.

That is a real gap, because their job includes deciding a hundred of these a week. Every padding value, every font size, every hover state is a design decision made by an engineer, whether or not a designer was involved.

The candidates who can say the second one uses one spacing scale and the first one has four arbitrary values, so the eye cannot find the grouping — those are the ones whose work does not need a designer standing behind them."

— Daniel A., frontend hiring manager, product company

That is the argument for putting both halves in one chapter. In most teams the same engineer is responsible for both, and the interview reflects it.

Why Angular and React together

Because at the level this chapter operates, they are the same subject.

Deciding what a component owns, where state lives, when to render on the server, how to keep a bundle small, how to build a design system, what makes a form usable — none of those change between frameworks. Only the spelling does.

Learning them side by side has a specific benefit: it separates what is genuinely a problem in frontend engineering from what is a quirk of one framework. A great many opinions people hold about "React" or "Angular" turn out to be opinions about rendering data on a screen.

Table 1 — The same decision, two vocabularies
The decisionAngular 22React 19
Declare a piece of statesignal(0)useState(0)
Derive a value from statecomputed(() => …)useMemo(() => …, [deps]), or nothing with the compiler
Reach outside the frameworkeffect(() => …)useEffect(() => …, [deps])
Pass data downinput()props
Send an event upoutput()a callback prop
Get a shared serviceinject(Service)useContext(Ctx), or a store hook
Give list items identitytrack item.idkey={item.id}
Split code by routeloadComponentReact.lazy / route-level splitting
Defer part of a page@defer (on viewport)<Suspense> + lazy, or a Server Component
Fetch as part of renderhttpResourceuse(promise) / a Server Component / a query library

Read that table as one column of decisions and two columns of syntax. The rest of this chapter is about the first column.

What the design round actually grades

A frontend design interview is not a quiz. It is a conversation, and it is scored on four things that have nothing to do with knowing an API.

Do you ask before you design? Who uses this, on what device, on what connection, how much data, how fresh must it be, what must never break. A candidate who designs before asking has failed the first test, however good the design is.

Do you name trade-offs? Every choice costs something. Presenting a design as obviously correct signals that you have not built enough of them.

Do you say what you would not build? This is the strongest single signal of seniority, because it means you have paid for over-engineering before.

Does the answer survive a follow-up? Interviewers push on one point. An answer assembled from memorised phrases collapses; an answer built from a model bends.

How the chapter is organised

Sections 02 to 06 are the architecture half: component design, state, rendering and delivery, performance, and design systems as code.

Sections 07 to 11 are the craft half: space, type, colour, component states and motion, and accessibility treated as a design problem rather than a compliance one.

Sections 12 to 16 are the drill — 175 questions across architecture, framework specifics, performance and accessibility scenarios, visual judgment, and full design questions.

Version facts as of September 2026: Angular 22 shipped June 2026, with signals, zoneless change detection, Signal Forms and the resource APIs all stable. React's current stable release is 19.2, with Server Components, Actions and the use API stable since React 19, and the React Compiler at 1.0.

Quick reference — Orientation

The two failure directions
Badly built — slow, tangled, unchangeable. Or well built and unusable — bad spacing, unreadable type, no affordance. The same engineer owns both.
Why both frameworks
At the architecture and craft level the decisions are identical; only the syntax differs. Learning both separates real frontend problems from framework quirks.
What the design round grades
Asking before designing; naming trade-offs; saying what you would not build; surviving one follow-up.
Versions, September 2026
Angular 22 (June 2026): signals, zoneless, Signal Forms, resources — all stable. React 19.2: Server Components, Actions, use stable; React Compiler 1.0.

02 · ArchitectureComponent Architecture — What a Component Owns

A component's design is decided by one question: what does it own? Everything else — how big it should be, what props it takes, whether it is reusable — follows from the answer.

The most common bad advice in frontend engineering is "keep components small". It is not wrong, it is useless — it gives you no way to decide where to cut.

The useful question is ownership. A component owns some state, some layout, and some knowledge of the domain. When one component owns things that change for different reasons, that is where the seam belongs.

The one split that pays for itself: container and presentational

The oldest useful distinction in component design, and the one people abandon and then rediscover.

A presentational component owns layout and appearance. It takes data as props or inputs, emits events, and knows nothing about where the data came from. It has no store, no HTTP client, no router.

A container component owns the wiring. It injects services or calls hooks, fetches, handles events, and passes plain data down.

Angular — the presentational halfruns offline
@Component({
  selector: 'app-task-card',
  template: `
    <article [class.done]="task().done">
      <h3>{{ task().title }}</h3>
      <button (click)="toggled.emit(task().id)">Toggle</button>
    </article>
  `,
})
export class TaskCard {
  readonly task = input.required<Task>();
  readonly toggled = output<string>();
  // No inject(). No HttpClient. No store. It cannot know where a Task comes from.
}
React — the identical componentruns offline
export function TaskCard({ task, onToggle }) {
  return (
    <article className={task.done ? 'done' : ''}>
      <h3>{task.title}</h3>
      <button onClick={() => onToggle(task.id)}>Toggle</button>
    </article>
  );
}
// No useContext. No fetch. No store hook. Same contract, same testability.

Read what both examples refuse to do. Neither knows how a task is loaded or saved. That single restriction gives you four things.

The rule that keeps it honest: a presentational component may not import a store, a router or an HTTP client. That is enforceable with a lint rule, and unenforced it decays within a quarter.

Where to cut, in order of usefulness

Once you accept that split, the remaining question is where to divide within each half. Four seams work, in this order.

Table 2 — Where to split a component, and the signal that says so
SeamThe signalWhat you gain
By ownership of state Two pieces of state in one component that never change together Independent re-render boundaries, and a smaller thing to reason about
By reuse The same markup appears in a second place One definition to change. Do this on the second occurrence, not the first
By loading boundary Part of the page is heavy, or below the fold A place to put @defer or Suspense, which is a real bundle win
By team boundary Two teams need to change the same file Fewer conflicts, clearer ownership — an organisational reason, and a legitimate one

Notice what is not on that list: line count. A 300-line component that owns one coherent thing is fine. A 40-line component that owns three unrelated things is not.

The prop explosion, and what it is telling you

A component that has grown fourteen props, half of them booleans, is a component that is doing several jobs. The boolean props are the tell — each one is a mode.

the smellruns offline
<UserCard
  user={user}
  compact={true}
  showAvatar={true}
  showEmail={false}
  showActions={true}
  isSelectable={true}
  isSelected={false}
  variant="outlined"
  onSelect={...}
  onEdit={...}
  onDelete={...}
/>

There are three cures and picking between them is the design decision.

Split into separate components when the modes are genuinely different things. UserCardCompact and UserCardDetailed sharing a smaller UserAvatar is often clearer than one component with a compact flag threaded through every branch.

Use composition when the caller should decide the contents. The component provides the frame and slots; the caller fills them. In Angular that is <ng-content>; in React it is children and named slot props.

composition instead of flags — Reactruns offline
<Card>
  <Card.Header><Avatar user={user} /><h3>{user.name}</h3></Card.Header>
  <Card.Body>{user.bio}</Card.Body>
  <Card.Actions><Button onClick={onEdit}>Edit</Button></Card.Actions>
</Card>
the same idea — Angularruns offline
<app-card>
  <div card-header><app-avatar [user]="user" /><h3>{{ user.name }}</h3></div>
  <p>{{ user.bio }}</p>
  <div card-actions><button (click)="edit()">Edit</button></div>
</app-card>

Group related props into one object when they genuinely travel together — but only then, because an object prop reconstructed on every render is a fresh identity and breaks memoisation in both frameworks.

The rule that governs all of it

A component should have one reason to change. If a visual tweak and a business rule change both land in the same file, that file is doing two jobs.

This is the single-responsibility principle applied to interfaces, and it produces a specific, checkable question in review: which requirement, if it changed, would force me to edit this file? More than one answer means there is a seam you have not cut.

Store / API signals or hooks TaskListPage — container injects, fetches, handles events knows the domain, owns no layout plain data down events up TaskCard props in, events out FilterBar props in, events out the presentational layer imports no store, no router, no HTTP client so it is testable with an object, and renderable in a gallery
Figure 1 — The container boundary. Everything that knows about the outside world lives above the line; everything below takes data as arguments and can be rendered anywhere.

Quick reference — Component architecture

The deciding question
What does this component own? Not how many lines it has.
Container vs presentational
Containers inject, fetch and handle. Presentational components take data and emit events, and import no store, router or HTTP client — enforce it with a lint rule.
Where to split
By state ownership, by reuse (on the second occurrence, not the first), by loading boundary, by team boundary.
Prop explosion
Many boolean props means many modes in one component. Cure it by splitting, by composing with slots, or by grouping props that genuinely travel together.
The review question
Which requirement, if it changed, would force an edit to this file? More than one answer means an uncut seam.
Object props
An object literal built inline is a new identity every render, which defeats memoisation in React and change-detection skipping in Angular. Hoist it into a memo or a computed.

03 · ArchitectureState — Four Kinds, and Why Most Arguments Are About the Wrong One

"Where should state live" is unanswerable until you notice that state means four different things with four different owners. Sort them first and the library question mostly disappears.

This is the single most valuable idea in the architecture half of this chapter, and it is framework-independent.

Table 3 — Four kinds of state, their owner, and where each belongs in both frameworks
KindExamplesOwnerAngularReact
Server cache Product list, user profile, search results The server. Your copy is a stale snapshot httpResource / resource Server Components, or TanStack Query
URL state Page, sort, filters, selected tab, open record The address bar Route params as inputs useSearchParams / router loader
Local UI state Dropdown open, hovered row, unsent draft One component signal() useState()
Shared client state Signed-in user, theme, cart, feature flags The application A service with signals Context, or Zustand/Jotai/Redux

The expensive mistake, in detail

Treating server cache as shared client state is the most costly architectural error in frontend work, and it is made because it looks like good discipline.

The reasoning goes: fetch the products once, put them in the global store, everything reads from one place. Clean. Single source of truth.

Except it is not a source of truth. It is a copy of someone else's truth, and the moment you store it you have signed up for cache invalidation.

What follows is predictable. Another user edits a record and your copy is wrong. A background job changes a status. The user opens a second tab. You start writing refetch-on-navigation, refetch-on-focus, refetch-on-a-timer, and a growing pile of "invalidate these keys after that mutation" logic.

At which point you have written a caching library inside your state library, badly, and it is the part of the codebase nobody wants to touch.

Server data is a cache with a freshness policy. Both ecosystems now have a purpose-built answer: Angular's resource APIs, and React's Server Components or a query library.

Angular — server cache as a resourceruns offline
// Not stored, not synchronised. A cache keyed by its inputs.
readonly query = signal('');
readonly products = httpResource<Product[]>(
  () => `/api/products?q=${encodeURIComponent(this.query())}`,
  { defaultValue: [] }
);
// products.value(), products.isLoading(), products.error(), products.reload()
// Changing query() refetches and cancels the previous request. No wiring code.
React — the same shape with a query libraryruns offline
const [query, setQuery] = useState('');

const { data = [], isPending, error, refetch } = useQuery({
  queryKey: ['products', query],      // the key IS the cache identity
  queryFn: ({ signal }) =>
    fetch(`/api/products?q=${encodeURIComponent(query)}`, { signal }).then(r => r.json()),
  staleTime: 30_000,                  // an explicit freshness policy
});

Read what both give you that a store does not. A freshness policy, automatic refetch when the inputs change, cancellation of the superseded request, and loading and error states that cannot get out of step with the data.

None of that is state management. It is caching, which is a different problem with a different solution.

URL state, and the three bug reports it eliminates

Filters, sort, page and the selected record belong in the address bar. Putting them there costs almost nothing and removes three recurring complaints.

The rule of thumb: if a user would expect it to survive a refresh or be shareable, it is URL state. If it would be strange to see it in a link — whether a dropdown is open — it is not.

Two details make it work in practice. Use replaceUrl (Angular) or replace: true (React) for continuous changes like typing in a search box, or every character becomes a history entry. And keep the parameter names short and stable, because they are a public interface once people bookmark them.

The escalation ladder for shared client state

Only the fourth kind — genuinely shared, genuinely client-owned state — is what "state management" arguments should be about. And most applications need very little of it.

Table 4 — Escalate only when the current rung hurts
RungAngularReactMove up when
1 · Component state signal + computed useState + derived values A sibling needs it and lifting would thread through three layers
2 · Shared, simple Service with signals Context, or Zustand The state graph is large, or you cannot answer "who changed this" quickly
3 · Structured store NgRx SignalStore Zustand slices / Jotai atoms You need a strict action log, audit, or time-travel debugging
4 · Full Redux pattern NgRx Store Redux Toolkit Rarely. Multi-team applications where the action log is the debugging tool

Most applications should live on rung two forever. Saying so in an interview is a senior answer, provided you can name what would change your mind.

The shape that makes rung two work

Whatever the framework, the pattern is the same: one private writable source, a read-only public view, derived values, and a small named set of writers.

Angular — a signal storeruns offline
@Injectable({ providedIn: 'root' })
export class CartService {
  private readonly _lines = signal<CartLine[]>([]);
  readonly lines = this._lines.asReadonly();          // nobody outside can set()

  readonly count    = computed(() => this._lines().reduce((n, l) => n + l.qty, 0));
  readonly subtotal = computed(() => this._lines().reduce((s, l) => s + l.qty * l.price, 0));

  add(p: Product, qty = 1) { this._lines.update(ls => mergeLine(ls, p, qty)); }
  remove(id: string)       { this._lines.update(ls => ls.filter(l => l.productId !== id)); }
  clear()                  { this._lines.set([]); }
}
React — the same store with Zustandruns offline
export const useCart = create((set, get) => ({
  lines: [],
  add:    (p, qty = 1) => set(s => ({ lines: mergeLine(s.lines, p, qty) })),
  remove: (id)         => set(s => ({ lines: s.lines.filter(l => l.productId !== id) })),
  clear:  ()           => set({ lines: [] }),
}));

// Derived values are selectors, so a component subscribes to exactly what it reads:
export const useCartCount = () =>
  useCart(s => s.lines.reduce((n, l) => n + l.qty, 0));

The payoff is identical in both. There are three functions in the entire application that can change a cart. A wrong total has three candidate causes, each ten lines long, rather than forty components that could have mutated the array.

That bounded set of named transitions is most of what a Redux store was ever bought for, without actions, reducers or a second mental model.

The subscription-granularity trap, in both frameworks

A store that exposes one large object makes every consumer depend on every field. A component showing only the cart count re-renders when an unrelated line's note changes.

In React the fix is selectors: useCart(s => s.lines.length) subscribes to the derived value, not the store. Passing no selector subscribes to everything.

In Angular the fix is exposing computed values rather than the raw state signal, so a component reads count() and is unaffected by changes that leave the count identical.

Both are the same principle: expose what consumers actually read, not the blob they read it from. A store designed as one object cannot be subscribed to precisely, whatever the library.

Quick reference — State

Four kinds
Server cache (server-owned), URL state (address-bar-owned), local UI state (component-owned), shared client state (app-owned).
The expensive mistake
Server data in a hand-maintained store. You then own cache invalidation and rebuild a caching library inside your state library.
Server cache tools
Angular: httpResource / resource. React: Server Components, or TanStack Query with an explicit staleTime.
URL state test
Would a user expect it to survive a refresh or be shareable? Then it is a query parameter. Use replace-not-push for continuous changes.
The ladder
Component state → a service or small store → a structured store → full Redux. Escalate on evidence; most applications stop at two.
The store shape
Private writable source, read-only public view, derived values, a small named set of writers. Same in both frameworks.
Granularity
Expose derived values, not one object. A store subscribed as a blob re-renders every consumer for every field.

04 · ArchitectureRendering & Delivery — Where the HTML Comes From

There are four places your HTML can be produced — the build machine, a server at request time, an edge node, or the user's browser — and the choice decides your first paint, your search visibility and your operational cost.

This is the highest-leverage architectural decision in a frontend, and it is made once and then lived with, so it is worth being precise about.

Table 5 — The rendering strategies, compared honestly
StrategyHTML producedFirst paintCostsChoose it when
Client-side (CSR) In the browser, after JavaScript runs Slowest — blank until the bundle executes No server; worst first paint; invisible to crawlers without JavaScript Anything behind a login. Internal tools, dashboards, admin
Static (SSG / prerender) At build time, once Fastest — a file from a CDN Rebuild to change content; not personalisable Marketing, documentation, blogs, stable catalogues
Server-side (SSR) Per request, on a server Fast — real content in the first response A server to run, scale and monitor; a class of server-only bugs Public, personalised or too-dynamic-to-build content
Incremental / edge Rendered once, cached, revalidated in the background Fastest after the first hit Cache invalidation; some users see slightly stale content Large catalogues where most pages change rarely

One application can and usually should mix them: prerender the marketing routes, server-render the public catalogue, leave the authenticated app client-rendered.

The part everyone underestimates: hydration

Server rendering gets you content on screen. It does not get you a working page.

Hydration is the client-side framework adopting that server-rendered DOM — walking the existing nodes, matching them to the components that would have produced them, and attaching event listeners.

Until it finishes, the page looks completely ready and responds to nothing. Users click, nothing happens, and they click again.

time → client-only blank content + interactive together SSR, full hydration looks ready, ignores clicks interactive SSR, incremental above the fold interactive rest hydrates on scroll or interaction request
Figure 2 — The gap that matters is between content appearing and the page responding. Server rendering moves the first marker left; only incremental hydration moves the second one left too.

Both frameworks now address this, from different directions.

Angular combines @defer (hydrate on viewport) with withIncrementalHydration(): a block is rendered on the server, visible immediately, and its JavaScript is neither downloaded nor executed until the trigger fires.

React attacks it with Server Components, which is a stronger version of the same idea: a Server Component's code never reaches the browser at all, because it produces output rather than being executed on the client.

React Server Components, explained for an Angular developer

This is the biggest genuine architectural difference between the two ecosystems in 2026, and it is worth understanding properly rather than as a buzzword.

In a Server Component, the component function runs only on the server. It can read a database directly, use secrets, and import a large formatting library — and none of that code is sent to the browser. What is sent is the rendered output.

React — a Server Componentruns offline
// No "use client" directive: this runs on the server only.
import { db } from '@/lib/db';
import { formatCurrency } from 'heavy-i18n-library';   // never shipped to the browser

export default async function ProductList({ category }) {
  const products = await db.product.findMany({ where: { category } });  // direct query

  return (
    <ul>
      {products.map(p => (
        <li key={p.id}>
          {p.name} — {formatCurrency(p.price)}
          <AddToCartButton productId={p.id} />   {/* a Client Component */}
        </li>
      ))}
    </ul>
  );
}
React — the interactive islandruns offline
'use client';   // this one DOES ship to the browser, because it needs state

export function AddToCartButton({ productId }) {
  const [pending, setPending] = useState(false);
  return <button disabled={pending} onClick={...}>Add to cart</button>;
}

Read what shipped. The product list's markup, and one small button component. Not the database client, not the formatting library, not the query logic.

The Angular equivalent does not exist in the same form. Angular renders the whole component tree on the server and then hydrates it on the client, so the component's code is shipped either way; incremental hydration defers executing it rather than sending it.

That is a real difference and worth stating plainly in an interview. It is also not free: Server Components require a server-rendering framework, they add a mental boundary that people get wrong — passing a function as a prop across the boundary fails — and they make the "where does this run" question something every developer must hold constantly.

Streaming, and why it changes the shape of a page

Server rendering does not have to be all-or-nothing. Streaming sends the page in pieces, so the fast parts arrive while the slow parts are still being produced.

In React that is <Suspense> with a fallback: the shell and header stream immediately, and the slow panel's markup arrives later and replaces its skeleton.

The design consequence is that a page's slowest data no longer sets the page's speed. A dashboard whose analytics panel takes two seconds can still show its header, navigation and three fast panels at 200 milliseconds.

Getting the benefit requires designing the skeletons deliberately — a skeleton that is a different size from the content it replaces converts a speed win into a layout-shift regression.

Choosing, in three questions

Is it behind a login? If yes, client-side rendering is almost certainly right. No crawler sees it, the user loads it once and keeps the tab open, and a server buys you nothing for a real operational cost.

Is the content the same for everyone? If yes, prerender it. Same first paint as server rendering, no server to run, and it cannot fail under load.

Is it public and personalised or too large to prebuild? Then server-render it, ideally with streaming and incremental hydration, and budget for the operational work that comes with running a rendering server.

Quick reference — Rendering & delivery

Four sources of HTML
Build machine (static), server at request time (SSR), edge with revalidation (incremental), browser (CSR).
The hydration gap
Between content appearing and the page responding. SSR moves the first marker left; only incremental hydration or Server Components move the second.
Angular's answer
provideClientHydration(withIncrementalHydration()) plus @defer (hydrate on …). Code is still shipped; execution is deferred.
React's answer
Server Components: the component runs only on the server and its code is never sent. Client Components are opt-in islands marked 'use client'.
Streaming
The page arrives in pieces, so the slowest data no longer sets the page's speed. Requires skeletons sized like their content, or you trade speed for layout shift.
The three questions
Behind a login → client-side. Same for everyone → prerender. Public and dynamic → server-render with streaming.

05 · ArchitecturePerformance & Web Vitals — Three Budgets, Measured on a Real Phone

Frontend performance is three separate budgets with three different causes: what the user downloads, how long until the page responds, and how much work each interaction costs. Conflating them is why optimisation efforts fail.

Before any technique, the discipline: measure on a production build, on a throttled connection, with CPU throttling. A development build on a fast laptop hides every problem your users have.

Table 6 — The three budgets, their metric, and the levers in each framework
BudgetMetricSymptomLevers
Download Largest Contentful Paint Slow first visit, fine afterwards Route splitting, deferring, dependency choice, image strategy, prerender or SSR
Startup Total Blocking Time Content visible, clicks do nothing Less bootstrap work, incremental hydration, Server Components, late third parties
Interaction Interaction to Next Paint Typing lags, scrolling stutters List identity, derived values, fewer rendered nodes, work off the main thread

A fourth metric sits across all three: Cumulative Layout Shift, how much content jumps as the page loads. It is the one frontend engineers cause most often and measure least.

The download budget

Look before you cut. Angular gives you ng build --stats-json plus an analyser; React build tools have equivalent bundle visualisers. The biggest rectangle is almost always a surprise, and the biggest win is usually one dependency.

The recurring findings are the same in both ecosystems.

Then the structural levers: split by route, and defer the heavy things inside a page.

deferring the same chart in both frameworksruns offline
<!-- Angular -->
@defer (on viewport) {
  <app-revenue-chart [data]="series()" />
} @placeholder (minimum 300ms) {
  <div class="chart-skeleton"></div>
} @loading (after 100ms; minimum 400ms) {
  <p>Loading chart…</p>
}
React — lazy plus Suspense, triggered by visibilityruns offline
const RevenueChart = lazy(() => import('./RevenueChart'));

function Panel({ series }) {
  const [visible, ref] = useInViewport();       // IntersectionObserver hook
  return (
    <div ref={ref} style={{ minHeight: 320 }}>   {/* reserve the space */}
      {visible && (
        <Suspense fallback={<ChartSkeleton />}>
          <RevenueChart data={series} />
        </Suspense>
      )}
    </div>
  );
}

Read the two details that are easy to skip. The minHeight and the placeholder must match the real content's size, or you have traded a bundle win for a layout shift. And Angular's after and minimum options exist to stop a spinner appearing at all on a fast connection, and flickering when it does.

Finally, budgets in the build. Angular has them natively in angular.json; React projects use a size plugin or a CI check. Set them just above the current number, so they catch a regression rather than sitting permanently red.

The interaction budget

Once loaded, slowness has a small number of causes, and they are checkable in order.

  1. List identity. A missing or unstable track (Angular) or key (React) means every render rebuilds every row. Check this first; it is free to fix and often the whole problem.
  2. Work in the render path. A method called from a template, or a filter recomputed on every React render, with no caching and no dependency tracking.
  3. Too many nodes. Five hundred rows times twenty elements is ten thousand nodes, and the browser's layout cost dominates whatever the framework does.
  4. Identity churn. An object or array literal built inline in a prop or binding is a new identity every render, defeating memoisation and change-detection skipping alike.
  5. Layout thrashing. Reading a measured value and then writing a style, repeatedly, forcing the browser to recompute layout each time. This shows in the profiler as layout, not scripting.

The frameworks differ in how you fix the second and fourth, and the difference is worth knowing.

Table 7 — Avoiding wasted work, in each framework
ProblemAngularReact
Expensive derived value computed() — lazy and cached automatically useMemo, or nothing at all with the React Compiler
A child re-rendering for no reason OnPush — the default since v22 — plus stable input identities React.memo, or the compiler's automatic memoisation
A callback prop changing identity every render Not an issue — methods are stable class members useCallback, or the compiler
Long list CDK virtual scroll, or pagination TanStack Virtual or react-window, or pagination

The React Compiler at 1.0 changes that column meaningfully: it inserts memoisation automatically, so useMemo and useCallback become an optimisation you rarely write by hand. It is worth saying in an interview that this closes most of the gap that made Angular's model feel more predictable.

Images, which are usually the largest thing on the page

On a content-heavy page, the image strategy is worth more than any JavaScript optimisation.

The rules are the same everywhere. Always set width and height, so the space is reserved and nothing shifts. Lazy-load everything below the fold, and explicitly not the one image that is the Largest Contentful Paint element — that one should be prioritised. Serve modern formats and correct sizes for the device rather than a desktop image scaled down in the browser.

Angular's NgOptimizedImage enforces these — it requires dimensions, lazy-loads by default, preloads the priority image, and warns when a source is oversized. React's meta-frameworks provide an equivalent image component. Using either is strictly better than a bare <img>.

Third-party scripts, the problem you do not control

On most commercial pages, third-party scripts are the largest performance problem and the one engineers have least authority over.

The approach that works is to measure them separately, so their share of main-thread time is visible to the people who add them. Then: remove what nobody uses, load the rest late and asynchronously, load on interaction where possible — a chat widget loaded when the chat button is clicked rather than on every page view is often several hundred kilobytes saved — and move analytics server-side where you can.

And set a policy: every third party has an owner, a purpose and a review date, or the list only grows.

🧠 Brain power

A team reduces their JavaScript bundle from 800 KB to 400 KB. Largest Contentful Paint does not improve at all. What are the three most likely explanations?

Think first, then open

The LCP element is an image, not text. If the largest visible element is a hero image, its size and priority determine the metric, and halving the JavaScript changes nothing. Preloading that one image usually moves it more than the entire bundle reduction did.

The critical path is not JavaScript. A render-blocking stylesheet, a synchronous third-party script in the head, or a font that blocks text rendering will hold the paint regardless of bundle size.

The server is the bottleneck. If time-to-first-byte is 900 milliseconds, the browser has not started downloading anything yet, and no client-side optimisation touches that.

The lesson is the one this section opens with: identify which budget you are spending before optimising. Bundle size is the most visible number and frequently not the binding constraint.

Quick reference — Performance

Three budgets
Download (LCP), startup (blocking time), interaction (INP). Plus layout shift across all three. Diagnose which before optimising.
Measurement discipline
Production build, throttled network, throttled CPU, real user metrics at the 95th percentile rather than averages.
Bundle bloat, usual causes
Namespace imports, all locales, barrel files, packages with no ES-module build, duplicate versions.
Deferring
Angular @defer with placeholder and loading timings; React lazy plus Suspense with reserved space. Always reserve the size or you trade speed for layout shift.
Interaction checklist
List identity, work in the render path, node count, identity churn in props, layout thrashing — in that order.
React Compiler 1.0
Inserts memoisation automatically, so hand-written useMemo and useCallback become rare. Closes most of the predictability gap with Angular's model.
Images
Dimensions always, lazy below the fold, priority on the LCP element, modern formats at device size. Use the framework's image component.

06 · The bridgeDesign Systems & Tokens — Where Architecture Meets Craft

A design system is not a component library. It is a set of named decisions — about space, colour, type and behaviour — that components then express. Getting the decisions right is what makes a hundred screens look like one product.

This section is the hinge of the chapter. Everything before it is architecture; everything after is craft; a design system is both, because it is craft expressed as code.

The three layers

A design system that works has three layers, and confusing them is the commonest failure.

Table 8 — The layers, and what belongs in each
LayerWhat it isExampleChanges when
Tokens Named values. The vocabulary --space-4: 1rem, --color-danger: … The brand changes. Rarely
Primitives Unstyled behaviour: focus, keyboard, ARIA A dialog that traps focus and restores it Almost never
Components Tokens plus primitives, with a visual identity <Button variant="danger"> Often, as the product evolves

The layering matters because a consumer who needs something unusual can drop a layer instead of forking the whole thing. That is the difference between a design system people use and one people work around.

Tokens as CSS custom properties, and why that specific choice

Design tokens can be expressed several ways — a JavaScript object, a Sass map, CSS custom properties. Custom properties win for one decisive reason: they cross component boundaries that selectors cannot.

Angular's view encapsulation rewrites selectors so a parent cannot style into a child. Shadow DOM blocks it entirely. CSS-in-JS scopes class names. In every case, a custom property still passes through, because it is an inherited value rather than a selector.

tokens.css — the whole vocabulary in one fileruns offline
:root {
  /* Space: one scale, geometric-ish, so sizes are distinguishable at a glance */
  --space-1: 0.25rem;   /*  4px */
  --space-2: 0.5rem;    /*  8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-12: 3rem;     /* 48px */

  /* Type: a modular scale, not arbitrary numbers */
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;

  /* Semantic colour: named by ROLE, never by appearance */
  --color-surface:      #ffffff;
  --color-surface-sunk: #f4f5f7;
  --color-text:         #1a1d21;
  --color-text-muted:   #5c6470;
  --color-border:       #dfe3e8;
  --color-accent:       #2f6fed;
  --color-danger:       #c0392b;

  --radius-sm: 4px;
  --radius-md: 8px;
}

/* Dark theme redefines the same names. Nothing else in the codebase changes. */
:root[data-theme="dark"] {
  --color-surface:      #16181c;
  --color-surface-sunk: #101216;
  --color-text:         #e8eaed;
  --color-text-muted:   #9aa3b0;
  --color-border:       #2b3038;
  --color-accent:       #6f9dff;
  --color-danger:       #e06c5c;
}

Read the naming rule, because it is the one that decides whether the system survives. The tokens are named by role — surface, text, border, danger — not by appearance.

A token called --color-blue-500 becomes a lie the moment someone adds a dark theme or rebrands, and then you have a codebase full of blue-500 references that are grey. A token called --color-accent stays true whatever value it holds.

The same applies to space. --space-4 survives a decision to change the base unit; --space-16px does not.

Consuming tokens in each framework

Angular — a themeable componentruns offline
@Component({
  selector: 'app-card',
  template: `<div class="card"><ng-content /></div>`,
  styles: [`
    .card {
      /* A local variable with a token default: callers may override it. */
      padding: var(--card-padding, var(--space-6));
      background: var(--color-surface);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-md);
      color: var(--color-text);
    }
  `],
})
export class Card {}
the caller adjusts it without reaching insideruns offline
/* This works through view encapsulation and through shadow DOM.
   A selector like `.dense app-card .card { padding: … }` would not. */
.dense-layout { --card-padding: var(--space-3); }

That pattern — a component-scoped variable with a token default — is the published contract. The component says which knobs exist; the caller turns them. Nobody writes selectors into anyone else's internals.

The variant question, in both frameworks

Every component library eventually needs variants, and there are two shapes. Getting this right prevents the prop explosion from section 02.

React — variants as data, not branchesruns offline
const VARIANTS = {
  primary:   'btn btn--primary',
  secondary: 'btn btn--secondary',
  danger:    'btn btn--danger',
};
const SIZES = { sm: 'btn--sm', md: '', lg: 'btn--lg' };

export function Button({ variant = 'primary', size = 'md', ...rest }) {
  // Spreading the rest means type, aria-*, data-* and onClick all pass through.
  return <button className={`${VARIANTS[variant]} ${SIZES[size]}`} {...rest} />;
}
Angular — the same idea with a host bindingruns offline
@Component({
  selector: 'button[appButton]',          // attribute selector on a REAL button
  host: {
    '[class]': `'btn btn--' + variant() + ' btn--' + size()`,
  },
  template: `<ng-content />`,
})
export class ButtonDirectiveComponent {
  readonly variant = input<'primary' | 'secondary' | 'danger'>('primary');
  readonly size = input<'sm' | 'md' | 'lg'>('md');
}
// Used as: <button appButton variant="danger" (click)="del()">Delete</button>

Read the Angular selector. Using button[appButton] rather than <app-button> means the element genuinely is a <button>, so it keeps native keyboard behaviour, form submission, focus and the correct role for free.

Wrapping a button inside a custom element is how component libraries accidentally break keyboard users, because every native behaviour then has to be re-implemented and one always gets missed.

What a design system needs beyond components

A library used by more than one team needs four things that have nothing to do with design, and their absence is why teams pin an old version and stop upgrading.

Quick reference — Design systems

Three layers
Tokens (named values), primitives (unstyled behaviour), components (tokens plus primitives with an identity). Consumers drop a layer instead of forking.
Why CSS custom properties
They cross view encapsulation and shadow DOM because they are inherited values, not selectors. Selectors cannot reach into a child; variables can be handed to one.
Name by role, not appearance
--color-accent, not --color-blue-500. --space-4, not --space-16px. Appearance names become lies at the first theme or rebrand.
The theming contract
A component-scoped variable with a token default: var(--card-padding, var(--space-6)). The component publishes the knobs; callers turn them.
Variants
A lookup from variant name to class, not a chain of conditionals. Spread remaining props so ARIA, data attributes and handlers pass through.
Wrap native elements, do not replace them
An attribute selector on a real <button> keeps keyboard, focus and form behaviour. A custom element must re-implement all of it.
What makes it adoptable
Semantic versioning, migrations for breaking changes, test harnesses, and a stated policy for what does not belong in it.

07 · CraftLayout, Space & the Grid — The Thing That Separates Amateur From Professional

Spacing is the single strongest signal of whether an interface was designed or assembled. Not colour, not typography — space. And it is governed by two rules that take ten minutes to learn.

Show two versions of the same card to a hundred people and most will prefer one without being able to say why. Almost always the difference is spacing, and almost always it comes down to the same two things.

Rule one: one scale, and only values from it

Amateur interfaces contain padding values like 13px, 17px, 22px, 9px — each chosen in the moment because it looked right in that spot.

The result is that nothing lines up and no relationship is legible. The eye is extraordinarily good at detecting near-misses, and a 13px gap next to a 14px gap reads as a mistake even to someone who cannot measure it.

A spacing scale is a small set of values, all multiples of a base unit, usually 4px or 8px. Every margin, padding and gap in the entire application comes from that set.

a working scale, with the reason for the gapsruns offline
--space-1:  4px;   /* hairline gaps: icon to its label */
--space-2:  8px;   /* tight: within a control */
--space-3:  12px;  /* between closely related lines */
--space-4:  16px;  /* the default gap between elements */
--space-6:  24px;  /* between groups inside a card */
--space-8:  32px;  /* between cards */
--space-12: 48px;  /* between page sections */
--space-16: 64px;  /* major section breaks */

Notice what is missing. There is no 20px and no 28px. The steps get further apart as they grow, roughly geometrically, because two adjacent values must be obviously different.

A linear scale — 4, 8, 12, 16, 20, 24, 28, 32 — fails at the top end, because 28 and 32 are indistinguishable in use and the choice between them becomes arbitrary again.

The practical benefit is that spacing stops being a decision. You are choosing between "the default" and "one step bigger", not between 16 and 18.

Rule two: proximity means grouping

The eye groups things that are close together. This is not a style preference; it is how human vision works, and it means spacing is not decoration — it is information.

Which produces the rule that fixes most bad layouts:

The space between groups must be larger than the space within a group.

When a label sits 16px above its input and 16px below the previous field, the eye cannot tell which input the label belongs to. Every form with this problem feels vaguely confusing and nobody can say why.

Equal spacing — which label owns which input? Email address Password Confirm password 16 16 16 every gap identical → no grouping information Grouped — label belongs to the input below it Email address Password Confirm password 6 24 within-group 6, between-group 24 → the grouping is visible same content, same components, one changed rule
Figure 3 — Proximity carries meaning. On the left every gap is 16px, so the label could belong to the field above or below. On the right the ratio does the work, and no border or box is needed to show the grouping.

A useful ratio to start from is 1:3 — if elements within a group sit 8px apart, groups sit 24px apart. Then adjust by eye.

The same rule explains why adding borders and boxes rarely fixes a confusing layout. If the spacing already carries the grouping, the border is redundant; if it does not, the border is compensating for a spacing problem and the result looks busy.

The four layout primitives

Almost every layout in an application is one of four patterns. Building them as reusable primitives rather than hand-rolling each screen is what makes fifty screens consistent.

Table 9 — The layout primitives and what each solves
PrimitiveWhat it doesImplementation
Stack Vertical rhythm — one consistent gap between children display: flex; flex-direction: column; gap: var(--space-4)
Cluster A row of items that wraps gracefully — tags, toolbar buttons display: flex; flex-wrap: wrap; gap: var(--space-2)
Grid Cards that reflow by available width, with no breakpoints grid-template-columns: repeat(auto-fill, minmax(280px, 1fr))
Sidebar A fixed-ish column beside a flexible one, collapsing when narrow Flex with flex-basis and a min-width on the main area

Use gap, not margins on children. A margin on a child is a statement about its neighbours that the child cannot know, which is why margin-based spacing produces the classic collapsed-margin and last-child bugs. gap belongs to the container, which is the thing that actually knows about the relationship.

Responsive layout without breakpoints

Breakpoints are a blunt instrument: they respond to the viewport, while the thing that actually matters is how much space this component has.

A card in a wide sidebar and a card in a narrow main column need different layouts at the same viewport width, and no media query can express that.

intrinsic layout — reflows with no media query at allruns offline
.card-grid {
  display: grid;
  /* As many columns as fit at 280px minimum; they stretch to fill. */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}
container queries — respond to the component's own widthruns offline
.card-host { container-type: inline-size; }

/* This card goes horizontal when ITS container is wide enough —
   regardless of the viewport, so it works in a sidebar and in a main column. */
@container (min-width: 420px) {
  .card { display: grid; grid-template-columns: 120px 1fr; gap: var(--space-4); }
}

Container queries are the more correct model, and they remove a category of bug where a component looks right on the page it was designed for and wrong everywhere else.

Keep media queries for genuinely page-level decisions — whether the navigation is a sidebar or a drawer — and use container queries for components.

Alignment, and the one exception

Everything that can share an edge should share an edge. A left-aligned column of labels, inputs and buttons is legible because the eye follows one line down the page; a layout where each element starts at a slightly different x-position feels unstable, again without the viewer knowing why.

The exception is optical alignment. Mathematical centring is sometimes visibly wrong, most often with icons: a play triangle centred by its bounding box looks left-of-centre because its visual mass is on the left. Designers nudge it a pixel or two right.

The practical rule: align mathematically by default, and trust your eye over the measurement in the small number of cases where they disagree.

Density is a product decision, not a default

How much space an interface uses is a choice about who it is for, and getting it wrong makes an otherwise good design feel wrong for its audience.

Generous spacing suits consumer products, marketing, and anything used occasionally: it is calmer, easier to scan, and communicates confidence.

Dense spacing suits professional tools used all day: a trading screen, a support console, an admin table. A user who looks at the same screen for eight hours wants more information per screen and less scrolling, and generous whitespace becomes an obstacle.

The mistake is applying consumer spacing to a professional tool because it looks better in a screenshot. The people who use it every day will hate it, and they are right.

The good compromise is a density token — one variable that scales the whole spacing scale — so the same components serve both, and users of data-heavy screens can choose.

Quick reference — Layout & space

One scale
All spacing from a small set of multiples of 4 or 8, with steps growing roughly geometrically so adjacent values are obviously different.
Proximity means grouping
Space between groups must exceed space within a group. Start from about 1:3. This single rule fixes most confusing forms.
Borders do not fix spacing
If proximity carries the grouping, a border is redundant; if it does not, the border is compensating and the result looks busy.
Four primitives
Stack (vertical rhythm), cluster (wrapping row), grid (auto-fill cards), sidebar. Build once, use everywhere.
gap, not child margins
Spacing is a property of the relationship, which the container knows and the child does not.
Container queries over breakpoints
Components should respond to their own width, not the viewport's. Media queries stay for page-level layout decisions.
Density is a product decision
Generous for occasional consumer use; dense for tools people stare at all day. Expose it as a token rather than picking one globally.

08 · CraftTypography — Most of Your Interface Is Text

Almost every interface is mostly words. Four decisions — the size scale, the line length, the line height and how hierarchy is signalled — determine whether those words are comfortable to read or quietly exhausting.

Typography is the highest-volume design decision in an application and the one engineers most often make by accident, because text appears whether or not anybody thought about it.

A type scale, for the same reason as a spacing scale

Arbitrary font sizes produce the same problem as arbitrary spacing: sizes that are close but not equal read as errors, and a reader cannot tell which of two headings is more important.

A modular scale multiplies a base size by a constant ratio, so each step is proportionally rather than linearly different.

a 1.25 ratio scale from a 16px baseruns offline
--text-xs:   0.75rem;   /* 12px — captions, timestamps, legal text */
--text-sm:   0.875rem;  /* 14px — secondary text, table cells, labels */
--text-base: 1rem;      /* 16px — body. Never go below this for prose */
--text-lg:   1.125rem;  /* 18px — lead paragraphs, card titles */
--text-xl:   1.375rem;  /* 22px — section headings */
--text-2xl:  1.75rem;   /* 28px — page headings */
--text-3xl:  2.25rem;   /* 36px — hero */

16px is a floor for body text, not a suggestion. It is the browser's default because it is what most people can read comfortably, and it is also the threshold below which iOS Safari zooms the page when a user focuses an input — a real, visible bug caused by a 14px font size on a form field.

Smaller sizes are legitimate for genuinely secondary information: table cells, captions, metadata. They are not legitimate for anything a user has to read carefully.

Line length is the most under-rated typographic decision

The measure is the number of characters on a line, and the comfortable range is about 45 to 75 characters, with 65 as a good target.

The reason is mechanical. At the end of each line the eye must travel back to the start of the next one and find it. Too long and it loses its place, re-reads a line, and tires. Too short and the constant return breaks the rhythm of reading.

the one-line fixruns offline
.prose {
  max-width: 65ch;        /* ch = width of "0" in the current font */
  line-height: 1.6;
}

The ch unit is exactly right for this, because it scales with the font. A width in pixels breaks when the font size changes; 65ch stays 65 characters.

This is the single most common reason a full-width text block on a wide monitor is unpleasant to read: 160-character lines, and the reader gives up two paragraphs in without knowing why.

Line height depends on both size and measure

Line height is not one number. It varies with the size of the text and the length of the line, and getting it wrong is what makes a heading look cramped or a paragraph look disconnected.

Table 10 — Line height by role
TextLine heightWhy
Body prose1.5 – 1.7The eye needs a clear path back to the next line
Long-measure textToward 1.7Longer lines need more vertical separation to track
Large headings1.1 – 1.25Large text already has visual separation; 1.5 looks disconnected
Dense UI labels1.3 – 1.4Compact, but not touching
Single-line controls1A button's label has no next line to relate to

The relationship worth remembering: as text gets bigger, line height gets proportionally smaller. A 36px heading at 1.5 has 18px of space between lines and looks like two separate things.

And always express line height as a unitless number. line-height: 1.5 scales with the element's font size; line-height: 24px does not, and breaks the moment a child has a different size.

Hierarchy needs more than size

Beginners signal importance with size alone, which produces a page of competing large text and no clear order.

There are five tools, and using two or three together is far more effective than pushing one hard.

A practical target is three levels of hierarchy on a screen. More and the levels stop being distinguishable, which is the same failure as a spacing scale with steps that are too close.

hierarchy without shoutingruns offline
.card-title  { font-size: var(--text-lg); font-weight: 600; color: var(--color-text); }
.card-meta   { font-size: var(--text-sm); font-weight: 400; color: var(--color-text-muted); }
.card-body   { font-size: var(--text-base); line-height: 1.6; color: var(--color-text); }

/* Two size steps and a colour change carry three levels.
   No 28px title required. */

Fonts, loading and the layout shift they cause

A custom font must download before it can render, and what happens in the meantime is a design decision with a performance consequence.

font-display: swap shows a fallback immediately and swaps when the custom font arrives. The text is readable straight away, at the cost of a visible reflow — the classic flash of unstyled text.

That reflow is a layout shift, and it is one of the commonest causes of a poor Cumulative Layout Shift score. Three things reduce it.

Preload the fonts you use above the fold, so they arrive early. Subset them to the characters you actually need, which often cuts the file by most of its size. And match the fallback's metrics with size-adjust and the ascent-override family, so the fallback occupies almost exactly the same space and the swap barely moves anything.

The option always worth considering first: a system font stack, which loads instantly, costs nothing, and looks native on every platform. For an internal tool it is very often the right answer, and the argument against it is usually brand rather than usability.

Two details that matter more than they should

Tabular numerals for anything in a column. By default many fonts give digits different widths, so a column of prices does not line up and comparing them requires effort. font-variant-numeric: tabular-nums makes every digit the same width. Use it on every table of numbers, every price list, every timer.

Truncation is a last resort, and it must be honest. Cutting text with an ellipsis hides information; if the full value matters, it needs to be reachable — a tooltip, a title attribute, or wrapping to two lines with -webkit-line-clamp.

Truncating in the middle is sometimes better than at the end: for a filename or an identifier, the beginning and the end are both meaningful and the middle is not.

Quick reference — Typography

Modular scale
A base size times a constant ratio, around 1.2–1.33. Never arbitrary sizes.
16px floor for body
The browser default and the comfortable minimum. Below 16px on a form input, iOS Safari zooms the page.
Measure
45–75 characters, 65 as a target. max-width: 65ch, because ch scales with the font and pixels do not.
Line height
1.5–1.7 for prose, 1.1–1.25 for large headings, 1 for single-line controls. Bigger text needs proportionally less. Always unitless.
Hierarchy
Size, weight, colour, space, case — combine two or three rather than pushing size. Three levels per screen is usually the limit.
Font loading
swap plus preload, subsetting, and metric-matched fallbacks with size-adjust. Or a system stack, which is free and often correct.
Tabular numerals
font-variant-numeric: tabular-nums on every column of numbers, or they do not line up.
Truncation
Hides information, so the full value must stay reachable. Middle-truncate identifiers and filenames.

09 · CraftColour, Contrast & Theming — Fewer Colours Than You Think

A professional interface uses far fewer colours than a beginner's, and assigns each one a job. Colour carries meaning, and meaning is destroyed by having too much of it.

The instinct when building an interface is to add colour to make it interesting. The instinct is wrong, and it is worth understanding why before looking at any palette.

Colour is a limited resource. If everything is coloured, nothing stands out — the accent that was supposed to draw the eye to the primary action is competing with six other coloured things.

The palette an application actually needs

Most interfaces need remarkably little colour, structured into three groups.

Table 11 — What each part of the palette is for
GroupMembersJob
Neutrals 5–8 greys: page, surface, sunken surface, border, muted text, text, strong text Ninety percent of the interface. Structure without shouting
One accent A base, a hover, a subtle background tint The primary action and the current selection. One accent, used rarely
Semantic Danger, warning, success, info — each with a text, border and tint variant State that must be recognised at a glance

That is roughly eighteen values, and it is enough to build an entire product. A page where the accent appears once — on the primary button — is far more effective at directing attention than one where six things are blue.

The naming rule from section 06 applies with full force here: name by role, never by hue. --color-danger survives a rebrand from red to orange; --color-red-600 becomes a lie that is then scattered through two hundred files.

Contrast is a requirement, not an aesthetic

Contrast ratio measures the difference in perceived brightness between two colours, from 1:1 (identical) to 21:1 (black on white).

Table 12 — The thresholds worth memorising
ContentMinimumNotes
Body text4.5:1The one people fail. Light grey on white is typically 2.5:1
Large text (18pt+, or 14pt bold)3:1Headings, but not body set large
Interactive element boundaries3:1An input's border must be visible against its background
Focus indicators3:1Against both the element and the surrounding background
Meaningful icons3:1Decorative ones are exempt, if genuinely decorative

The failure everyone makes is muted text that is too muted. A designer picks a soft grey on a good monitor in a dim room, and it becomes invisible on a laptop outdoors, or to a user over fifty, or to anyone with reduced contrast sensitivity.

Muted does not mean low contrast. It means lower than the primary text, and still above 4.5:1 — which is achievable and is what a good neutral ramp is designed to give you.

The other frequent failure is placeholder text used as a label. Placeholders are usually styled at 2:1 or worse, they disappear when the user types, and they leave the field unlabelled for a screen reader. A placeholder is a hint, never a label.

Colour must never be the only signal

Roughly one in twelve men has some form of colour vision deficiency, most commonly difficulty distinguishing red from green.

Which means a status column showing red and green dots is unreadable to a meaningful share of users, and a validation error signalled only by a red border communicates nothing to them.

The fix is always the same: pair colour with a second channel — an icon, a word, a shape, a pattern.

colour plus a second signalruns offline
<!-- Not enough: colour is the only difference -->
<span class="status status--error">●</span>

<!-- Better: shape, text and colour agree -->
<span class="status status--error">
  <svg aria-hidden="true"><!-- a cross icon --></svg>
  Failed
</span>

<!-- A form error: icon, text, border, and aria wiring -->
<input id="email" aria-invalid="true" aria-describedby="email-err">
<p id="email-err" class="field-error">
  <svg aria-hidden="true"><!-- warning icon --></svg>
  Enter a valid email address
</p>

The quickest self-check: screenshot the screen and desaturate it. If you can no longer tell what is happening, colour is doing work that something else should share.

Dark mode is not an inversion

The naive implementation flips black and white and produces something that is uncomfortable in a specific, recognisable way. Four things need to change rather than invert.

Pure black is the wrong background. White text on pure black produces halation — the letters appear to glow and vibrate, especially for people with astigmatism. Use a very dark grey, around #16181c, and near-white rather than pure white for text.

Saturated colours become harsher. A blue that reads as calm on white can look aggressive on dark. Dark themes generally need slightly desaturated, slightly lighter accents.

Elevation reverses. In a light theme, a raised surface casts a shadow. In a dark theme shadows are nearly invisible, so raised surfaces are indicated by being lighter than the background. That is why a dark theme needs several surface tokens rather than one.

Contrast must be re-checked, not assumed. A pair that passes on light frequently fails on dark, and the tooling will not tell you unless you look.

theming that respects the system and allows an overrideruns offline
/* Light is the default. */
:root {
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-text: #1a1d21;
  --color-accent: #2f6fed;
  --shadow-card: 0 1px 3px rgb(0 0 0 / 0.12);
}

/* Follow the operating system, unless the user chose light explicitly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-surface: #16181c;          /* not #000 */
    --color-surface-raised: #1e2128;   /* raised = lighter, not shadowed */
    --color-text: #e8eaed;             /* not #fff */
    --color-accent: #6f9dff;           /* lighter, less saturated */
    --shadow-card: none;
  }
}

/* An explicit dark choice wins in both directions. */
:root[data-theme="dark"] {
  --color-surface: #16181c;
  --color-surface-raised: #1e2128;
  --color-text: #e8eaed;
  --color-accent: #6f9dff;
  --shadow-card: none;
}

Read the structure, because it is the part people get wrong. Every token has a value on bare :root, so nothing is defined only inside a media query. The media block is guarded so an explicit light choice wins. And the explicit dark block repeats the values so a toggle works in both directions rather than only when the system is already dark.

A theme implemented as "define everything in the dark media query" breaks the moment you add a toggle, and that is a rewrite rather than a fix.

The flash of the wrong theme

If the user's theme choice is stored and applied by JavaScript after the page loads, they see the default theme for a moment first — a white flash for a dark-theme user, at every navigation.

The fix is a tiny synchronous script in the document head that reads the stored preference and sets the attribute on the root element before the first paint. It must be inline and blocking, which is one of the very few cases where that is correct.

With server-side rendering the same information can come from a cookie, so the server renders the right theme and there is no flash at all.

Quick reference — Colour

The palette
5–8 neutrals, one accent with a hover and a tint, four semantic colours with text/border/tint variants. About eighteen values for a whole product.
Colour is scarce
If everything is coloured, the accent stops meaning "this is the action". Use it once per screen where possible.
Contrast thresholds
4.5:1 body text, 3:1 large text, 3:1 for control boundaries and focus rings. Muted means lower than primary, still above 4.5:1.
Never colour alone
Pair with an icon, a word or a shape. Self-check by desaturating a screenshot.
Placeholders are not labels
Low contrast, disappear on typing, invisible to screen readers. Always a real <label>.
Dark mode is not inversion
Dark grey not black, near-white not white, lighter and less saturated accents, elevation by lightness rather than shadow, and contrast re-checked.
Theme structure
All tokens defined on bare :root; the media query guarded against an explicit light choice; an explicit dark block so the toggle works both ways. Apply the stored choice before first paint.

10 · CraftStates, Affordance & Motion — The Half Nobody Designs

A component is not one thing. A button has at least seven states, and the difference between a professional interface and an amateur one is usually that someone designed all of them rather than one.

Design tools show a component at rest. Real users encounter it hovered, focused, pressed, loading, disabled, in error, and empty. The states nobody drew are the states that get implemented by accident.

The seven states of an interactive element

Table 13 — What each state must communicate, and how it usually goes wrong
StateMust communicateCommon failure
DefaultThat it is interactive at allA link that looks like text; a button with no boundary
Hover"You are pointing at this"Nothing changes, or it changes so much the layout moves
Focus"Keyboard input goes here"outline: none with nothing replacing it — the single most damaging line in frontend CSS
Active"Your press registered"Missing, so a slow action feels like a dead click
Loading"It is working; do not click again"Not disabled, so a double-click submits twice
DisabledNot available, and ideally whyLow contrast, no explanation, and not focusable so a keyboard user cannot find out why
ErrorWhat went wrong and what to doA red border with no message, or a message far from the field
button.css — all seven, deliberatelyruns offline
.btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.btn:hover:not(:disabled)  { background: var(--color-accent-hover); }

/* :focus-visible shows the ring for keyboard users and not on mouse click.
   The old :focus made every mouse click show a ring, which is why people
   removed it entirely and broke keyboard access for everyone. */
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled {
  background: var(--color-surface-sunk);
  color: var(--color-text-muted);   /* still 4.5:1 — disabled is not invisible */
  cursor: not-allowed;
}

.btn[aria-busy="true"] { pointer-events: none; opacity: 0.7; }

The focus ring is the line to defend in code review. outline: none with no replacement makes an application unusable by keyboard — the user tabs and has no idea where they are.

It is written because the default ring appears on mouse clicks and looks untidy. :focus-visible solves exactly that: the browser decides, showing the ring for keyboard navigation and not for a mouse press. There has been no good reason to remove focus outlines since it shipped.

Affordance: does it look like what it does?

An affordance is a visual property that suggests how something can be used. A raised, bounded shape suggests pressing; underlined coloured text suggests following.

Flat design removed a lot of affordance in exchange for cleanliness, and the cost was real: users cannot tell what is clickable, so they click on nothing and miss things that are.

Three principles keep it honest.

Interactive things must be visually distinct from static ones — a boundary, a background, a colour, an underline. Not merely a hover state, because hover does not exist on touch and does not help someone deciding where to point.

Similar appearance must mean similar behaviour. If two things look alike and one is clickable, users will click both and learn to distrust the interface.

Touch targets need to be at least 44 by 44 pixels, whatever the visible size. A 16-pixel close icon can have padding that makes its hit area 44 pixels without changing how it looks.

Motion: what it is for, and the one setting you must respect

Animation in an interface has three legitimate jobs, and decoration is not among them.

Explaining a change of state. A panel that slides in from the right tells the user where it came from and where it will go back to. The same panel appearing instantly leaves them re-orienting.

Directing attention. A brief highlight on a newly arrived row draws the eye to what changed.

Making waiting bearable. A progress indicator that moves communicates that the system is alive.

Table 14 — Durations that feel right
InteractionDurationEasing
Hover, colour change100–150 msease
Small element entering150–250 msease-out — fast start, gentle stop
Panel or drawer250–350 msease-in-out
Full page transition300–400 msease-in-out

Anything over about 400 milliseconds feels slow, and a user who performs the action fifty times a day will come to resent it. The general rule is that animation should never be the reason a user waits.

ease-out for things entering is worth internalising: fast at the start and slow at the end feels responsive, because the movement begins immediately. ease-in for an entrance feels sluggish for exactly the opposite reason.

respecting reduced motion — not optionalruns offline
/* Some people experience nausea and dizziness from interface motion.
   The operating system setting is how they tell us. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

Note that this reduces rather than removes: a near-zero duration keeps transitions functionally intact, including any code that waits for a transition to end, while removing the motion.

The animations to reconsider entirely under reduced motion are large parallax effects, spinning loaders and anything that moves a lot of the screen at once — those are the specific triggers, and a fade is usually an acceptable substitute.

And one performance note: animate only transform and opacity. Those are handled by the compositor and do not force layout. Animating width, height, top or margin forces layout on every frame and is the usual cause of a janky animation.

Empty states, which are a design opportunity

The state a user sees first is usually the empty one, and it is almost always the least designed.

There are three distinct empty states and they need different content.

First use — nothing exists yet. This is an onboarding moment: explain what goes here and offer the action that creates the first one.

Filtered to nothing — data exists but not matching. Say so explicitly and offer a way to clear the filter, because the user's model is "there should be results here".

Failed to load — say it failed, offer a retry, and never let it look like the first two. A user who sees "no orders" when the request failed concludes their data is gone.

That last distinction is the most common production defect in frontend work and it costs exactly one extra branch in the template.

Quick reference — States & motion

Seven states
Default, hover, focus, active, loading, disabled, error. Design each; the ones you skip get implemented by accident.
:focus-visible
Shows the ring for keyboard users, not on mouse click. Removes every excuse for outline: none.
Disabled is not invisible
Keep it above 4.5:1 and explain why it is disabled, or a user has no way to find out.
Affordance
Interactive must look different from static without needing hover. Similar appearance must mean similar behaviour. Touch targets at least 44×44.
Motion jobs
Explain a change, direct attention, make waiting bearable. Not decoration.
Durations
100–150 ms hover, 150–250 ms small entrances with ease-out, 250–350 ms panels. Over 400 ms feels slow.
prefers-reduced-motion
Not optional. Reduce to near-zero rather than removing, so transition-end logic still works.
Animate transform and opacity only
Compositor-handled. Animating width, height or top forces layout every frame.
Three empty states
First use, filtered to nothing, failed to load. Conflating the third with the first is the commonest production defect on data screens.

11 · CraftAccessibility as Design — Mostly Not About ARIA

Most accessibility work is design work done earlier: enough contrast, real labels, visible focus, sensible order, and using the element the browser already made for the job. ARIA is what you reach for when no such element exists.

Accessibility gets treated as a compliance checklist applied at the end, which is why it is expensive. Almost everything in it is cheaper during design and code than as a retrofit.

The first rule, which does most of the work

Use the element the browser already provides.

A <button> is focusable, activates on Enter and Space, announces itself as a button, participates in forms, and shows a focus ring. A <div onclick> has none of that, and getting it back means tabindex="0", role="button", a keydown handler for both Enter and Space, and a focus style — four things, one of which is always forgotten.

The same applies throughout: <a> for navigation, <label> for labels, <fieldset> and <legend> for groups, <dialog> or a well-built primitive for modals, real headings in order.

The first ARIA rule, from the specification itself, says it plainly: no ARIA is better than bad ARIA. An incorrect role actively misleads a screen reader user, which is worse than no role at all.

the same control, two waysruns offline
<!-- Everything below is free, and correct on every platform. -->
<button type="button" (click)="close()">Close</button>

<!-- All of this is required to catch up, and it is still worse. -->
<div role="button" tabindex="0"
     (click)="close()"
     (keydown.enter)="close()"
     (keydown.space)="close(); $event.preventDefault()">
  Close
</div>

The five things that cover most real failures

Automated tools catch roughly a third of accessibility issues. These five are where the rest live, and they are all design decisions.

Every control has a real label. A <label for>, or aria-label where a visible label genuinely does not fit — an icon-only button. A placeholder is not a label: it vanishes when the user types and is announced inconsistently.

Focus is always visible and always somewhere sensible. Opening a dialog moves focus into it and traps it there; closing returns focus to the element that opened it. Removing the focused element — with an @if or a conditional render — drops focus to the document body, which loses a keyboard user's place entirely.

Headings form a real outline. One <h1>, then <h2>s, then <h3>s, with no skipped levels. Screen reader users navigate by headings the way sighted users skim, so a page whose headings were chosen by font size is a page they cannot navigate.

Dynamic changes are announced. In a single-page application a route change is silent — the URL changes and nothing tells a screen reader anything happened. Move focus to the new page's heading, or announce it in a live region. The same applies to validation results, toasts and rows arriving.

Colour is never the only signal, as in section 09.

Forms, where accessibility and usability are the same thing

an accessible field, with every part earning its placeruns offline
<div class="field">
  <label for="email">Email address</label>

  <input id="email" type="email" name="email"
         autocomplete="email"
         aria-describedby="email-hint email-error"
         aria-invalid="true">

  <p id="email-hint" class="hint">We use this for order confirmations only.</p>

  <!-- role="alert" makes it announced when it appears -->
  <p id="email-error" class="field-error" role="alert">
    <svg aria-hidden="true"><!-- icon --></svg>
    Enter a valid email address, for example name@example.com
  </p>
</div>

Read each attribute. for and id connect the label, so clicking the label focuses the field and a screen reader announces it. autocomplete lets the browser fill it, which is a genuine accessibility feature for anyone for whom typing is effortful. aria-describedby attaches both the hint and the error, so both are read. aria-invalid is what makes it announced as being in error. role="alert" makes the message announced when it appears rather than only when focus reaches it.

Every one of those also improves the experience for people with no impairment at all, which is the general pattern: accessible forms are simply better forms.

Testing it, in three layers

Automated — an accessibility linter on templates and an axe check in component tests. Catches contrast, missing labels and invalid ARIA on every commit, for free, and catches about a third of real issues.

Keyboard — tab through every new screen. Is everything reachable, is the focus ring visible, does the order match the visual layout, can you escape every dialog, can you complete the task without a mouse. Two minutes, and it finds most of what automation misses.

Screen reader — on the critical journeys, periodically. It reveals a category nothing else finds: meaningless announcements, controls announced as "button" with no name, and an order that makes no sense when read aloud.

The honest framing for a team: the automated layer is a gate, the keyboard pass is part of the definition of done, and the screen reader pass is a scheduled activity rather than a per-pull-request one.

Quick reference — Accessibility

First rule
Use the native element. A <button> brings focus, keyboard activation, role and form behaviour free; a <div role="button"> needs four things and one is always missed.
No ARIA beats bad ARIA
An incorrect role actively misleads, which is worse than none.
Labels
A real <label for>, or aria-label for icon-only controls. Placeholders are hints, never labels.
Focus
Always visible via :focus-visible; trapped in dialogs and restored on close; never dropped to the body by removing the focused element.
Headings
A real outline with no skipped levels — it is how screen reader users skim.
Announce changes
Route changes, validation results and arriving content are silent by default. Move focus, or use a live region.
Form attributes that matter
for/id, autocomplete, aria-describedby, aria-invalid, role="alert".
Three test layers
Automated as a CI gate, a keyboard pass in the definition of done, a screen reader pass on critical journeys periodically.

12 · DrillFrontend Architecture — Q1–Q45

These forty-five questions cover the decisions that shape a frontend before any component is written: what a component owns, where state lives, where HTML comes from, and how a codebase stays changeable at forty screens.

They are framework-independent on purpose. Where a framework's answer differs it is named, but the decision is the same one in both.

Say each answer out loud before revealing it, and for the design-shaped ones, start by saying what you would ask.

Drill · Components and boundaries

The first fifteen are about where to cut, and how to tell a good boundary from a habitual one.

Q1. "How do you decide where one component ends and the next begins?"

Reveal answer

The real test Whether you have a criterion or a habit.

Strong answer By ownership, not by size. The question I ask is what this component owns, and whether the things it owns change for the same reason.

The concrete review test is: which requirement, if it changed, would force me to edit this file? If there is more than one answer — a visual tweak and a business rule both land here — there is a seam I have not cut.

Beyond that, four seams are worth cutting on: separate state that never changes together, markup that has appeared a second time, a place where I want a loading boundary, and a boundary between teams.

What I deliberately do not use is line count. A three-hundred-line component owning one coherent thing is fine; a forty-line one owning three unrelated things is not.

Land it "Keep components small" gives you no way to decide where to cut; "one reason to change" does, and it is checkable in review.

Likely follow-ups
"Is there a downside to splitting too much?"

Yes. Excessive splitting means following a chain of five files to understand one screen, and props threaded through components that do not care about them.

It also creates false reuse: a component extracted on its first occurrence, shaped for one caller, and then bent out of shape when a second caller has slightly different needs. That is why I extract on the second occurrence, not the first.

Q2. "Explain container and presentational components. Is that pattern still relevant?"

Reveal answer

Strong answer A presentational component takes data as props or inputs, emits events, and imports no store, router or HTTP client. A container injects, fetches, handles events and passes plain data down.

It is more relevant than when it was named, not less, and the reason is testing and reuse. A presentational component is testable by passing an object — no providers, no mocked network, no store — and renderable in a component gallery, which only works for components that take data as arguments.

The version that went out of fashion was the dogmatic one, where every component had a paired container. The useful version is a layer boundary: route-level components inject freely, and the components below them take arguments.

I would enforce it with a lint rule on imports, because unenforced it decays within a quarter.

Land it The value is not purity, it is that the reusable half stays reusable and the coupling is confined to a thin layer.

Q3 · Scenario. "A component has fourteen props, six of them booleans. What do you do?"

Reveal answer

Strong answer Six booleans is six modes, so the component is doing several jobs and the props are the symptom.

Three cures, and choosing between them is the design decision.

Split it when the modes are genuinely different things. A compact variant and a detailed variant sharing a smaller avatar component is usually clearer than one component with a flag threaded through every branch.

Compose it when the caller should decide the contents — the component provides the frame and slots, the caller fills them. That converts showAvatar, showEmail and showActions from flags into markup the caller simply writes or does not.

Group props only when they genuinely travel together, and being aware that an object literal built inline is a new identity every render, which breaks memoisation in React and change-detection skipping in Angular.

Land it Boolean props that describe what to render are usually composition in disguise, and converting them removes both the flags and their combinations.

Likely follow-ups
"What is the risk of composition?"

That every caller assembles it slightly differently, so consistency is lost — which is precisely what a component was meant to enforce.

The mitigation is compound components with a constrained API: a Card exposing Card.Header, Card.Body and Card.Actions gives the caller flexibility inside the slots and no freedom about the frame.

Q4. "How do you design a component's public API?"

Reveal answer

Strong answer Starting from the call site. I write how I want it used before I write the component, because an API designed from the inside always leaks the implementation.

Four principles. Required things are required — enforced by the type, not documented. Defaults cover the common case, so the simplest use is one prop.

Names describe purpose, not appearance. variant="danger" not color="red", for the same reason design tokens are named by role: the appearance changes and the meaning does not.

Events say what happened, not what to do. (selected) rather than (openDialog), so the component does not assume what the parent will do about it.

And I would pass remaining attributes through — ARIA, data attributes, type, event handlers — so consumers are not blocked by an API I failed to anticipate.

Land it The attribute pass-through is the underrated one: without it, every unforeseen need becomes a change request to the library.

Q5. "When would you use composition over configuration?"

Reveal answer

Strong answer When the variation is about what is inside, and configuration when it is about how the frame behaves.

A card whose contents differ per caller is composition — slots, not flags. A button whose visual weight differs is configuration — a variant prop, because the caller should not be able to invent a fourth appearance.

The failure signal for configuration is a flag that would only ever be used once, or a growing set of flags whose combinations are untested. At that point the configuration object has become a programming language with worse tooling.

The failure signal for composition is that every caller assembles it differently and the product loses consistency — which is what compound components with a fixed frame are for.

Land it Configure the frame, compose the contents — and treat a single-use flag as a request for a slot.

Q6. "How should a component handle its own loading and error states — or should it?"

Reveal answer

Strong answer A presentational component should not fetch, so it should not own loading and error either. It should be able to render them, driven by props.

The shape that works is a container that owns the resource and passes down either the data or a state, and a presentational component that renders all four states from what it was given.

That keeps the presentational component testable in every state by passing an object, and it keeps the four states consistent across the application because they are rendered by the same components.

The alternative — a component that fetches its own data — is convenient at first and produces two problems: it cannot be rendered in a gallery or a test without a network, and a page of such components produces an uncoordinated cascade of independent spinners.

Land it Loading and error are page-level compositions as much as component ones, because a page with six independent spinners is worse than one with a coherent skeleton.

Q7. "What is prop drilling and when is it actually a problem?"

Reveal answer

Strong answer Passing a value through components that do not use it, purely to reach a descendant.

Two levels is not a problem — it is explicit, traceable, and the intermediate components stay reusable. Four or five levels is, because every intermediate component now has a prop it does not care about, and changing the shape means editing all of them.

The cures in order: move the state closer to where it is used; restructure so the consumer is a direct child, often by passing markup rather than data; then context or a service.

The cost of the context or service answer is that the component now cannot be rendered without that provider, so it becomes app-specific. That is fine for a container and a real loss for a presentational component.

Land it Prop drilling is explicit and slightly annoying; context is implicit and slightly dangerous — and two levels of annoyance beats hidden coupling.

Likely follow-ups
"How does passing markup instead of data avoid it?"

Because the deep consumer is created by the component that has the value, and then passed down as already-constructed content. The intermediate layers carry children rather than props, and never see the data at all.

In React that is passing elements as children or as a prop; in Angular it is content projection. It is the most under-used answer to prop drilling and it needs no new mechanism.

Q8. "How do you organise files in a large frontend codebase?"

Reveal answer

Strong answer By feature, not by technical type. A folder per feature holding its components, state, models and routes, so everything a change touches is in one place.

Top-level folders named components/, hooks/ and services/ look tidy and age badly: one change means editing four folders, and nothing tells you which files belong together.

Alongside features, a core/ for things there is exactly one of — authentication, HTTP setup, error handling — and a shared/ for genuinely reusable presentational components that know about no feature.

Each feature gets its own lazy route, so the folder boundary and the bundle boundary are the same line.

The test for whether the boundaries are real: can a new engineer delete a whole feature by deleting one folder? If that leaves dangling imports everywhere, the structure is decorative.

Land it Structure by what changes together, and enforce it with lint rules on imports, because a convention in a document loses to a deadline.

Likely follow-ups
"How do you keep shared/ from becoming a dumping ground?"

With an explicit admission rule: something belongs there only if two or more features use it and it knows about none of them. A component taking a domain object as a prop is not shared, it is that feature's component.

And enforcement — shared may import from nothing but itself and core. Once shared imports from a feature, the boundary is gone and everything transitively depends on that feature.

Q9. "Should features import from each other?"

Reveal answer

Strong answer Preferably not directly, because that is how two features become one and the dependency graph becomes a mesh.

If billing needs a customer's name, it should go through a shared model and a service rather than importing a component out of the customers feature.

When two features genuinely need the same domain logic, that logic has outgrown both. It belongs in its own module or library that both depend on, which keeps the graph a tree.

The practical reason is deletion and ownership: a feature that other features reach into cannot be changed or removed without coordination, which is the specific cost that structure was supposed to prevent.

I would enforce this with import rules rather than review, because it is exactly the kind of thing that happens under deadline pressure and is never revisited.

Land it The rule is that the dependency graph stays a tree; the moment it is a mesh, no part of it can be reasoned about alone.

Q10. "What goes in a monorepo and when is it worth it?"

Reveal answer

Strong answer A monorepo is worth it when several applications and libraries change together and you want one commit to span them.

The concrete benefits are atomic changes across a library and its consumers, one dependency version set so there is no diamond problem, shared tooling and CI configuration, and enforced boundaries through project tags rather than convention.

The costs are real: CI must be fast, which means affected-project detection and caching rather than building everything; the tooling itself is a thing to learn and maintain; and access control is coarser than separate repositories.

I would use one for several applications sharing a design system and domain libraries. I would not adopt one for a single application, where it adds tooling with nothing to coordinate.

Land it The deciding question is whether a change routinely needs to span two repositories today — if it does not, a monorepo is solving a problem you do not have.

Q11. "How do you decide what belongs in a shared component library versus an application?"

Reveal answer

Strong answer The library holds things that are used by more than one application and know nothing about any domain. Buttons, inputs, dialogs, tables, layout primitives, tokens.

The application holds anything that knows about the business — an order row, a customer card, a pricing widget. Those look reusable and are not, because the second consumer always needs it slightly differently and the component grows flags.

The test I use is whether the component would make sense in a completely different product. A DataTable would; an OrderTable would not.

The middle case is a domain component used by two applications in the same domain. That belongs in its own domain library rather than the design system, so the design system stays domain-free and the domain library can move faster.

Land it A design system that acquires domain knowledge stops being versionable independently, and then every product change needs a library release.

Q12. "What is a smart default, and why does it matter in component design?"

Reveal answer

Strong answer A default that makes the common case require no configuration, so the simplest correct use is also the shortest.

It matters because defaults are what most callers get. If a table defaults to no pagination, most tables in the product will have none; if it defaults to a sensible page size, most will be fine without anyone deciding.

The design consequence is that defaults should be chosen for correctness and safety rather than for minimal behaviour. A button that defaults to type="button" prevents the classic bug where a button inside a form unexpectedly submits it.

The related rule is that the dangerous option should be the verbose one. If a component can render raw HTML, that should require an explicitly named prop, so it is greppable in a review.

Land it Defaults are policy: whatever you default to is what most of the product will do, so choose them as decisions rather than as conveniences.

Q13 · Scenario. "Two teams need the same table with different behaviour. How do you avoid a fork?"

Reveal answer

Strong answer By separating what is genuinely shared from what is genuinely different, rather than adding flags until both are satisfied.

The approach I would take is to extract the shared part as a headless layer — sorting, selection, pagination and keyboard behaviour with no markup — and let each team render it themselves. That is what headless table libraries exist for, and it is the right shape here.

If the differences are only visual, the answer is tokens and slots: the frame is shared, the cell rendering is supplied per caller through templates.

If the differences are genuinely behavioural and irreconcilable, a fork is honest and a flag is not. Two components with a shared core is better than one component with a mode nobody understands.

What I would avoid is the configuration language failure: a props object that grows a flag per requirement until the combinations are untestable.

Land it Headless behaviour plus per-team rendering is the pattern that scales, because behaviour is what is genuinely common and markup is what is genuinely not.

Q14. "How do you approach a component that must render arbitrary user-supplied content?"

Reveal answer

Strong answer As a security question first and a rendering question second.

If the content is plain text, render it as text and the frameworks escape it for me — that is the safe default in both React and Angular.

If it must be rich, I would not accept HTML. I would accept a constrained format — Markdown, or a structured document model — and render it myself into known components. That way the set of possible outputs is defined by my code rather than by the input.

If HTML genuinely must be accepted, it is sanitised server-side with a well-maintained allowlist library, and rendered through the framework's sanitising binding rather than through an escape hatch.

The two things I would refuse: dangerouslySetInnerHTML or bypassSecurityTrustHtml on anything a user can influence, and client-side-only sanitisation, since the client is not a trust boundary.

Land it Accepting a constrained format rather than HTML turns an open-ended security problem into a closed rendering one.

Q15. "What makes a frontend codebase hard to change, in your experience?"

Reveal answer

Strong answer Four things, in roughly this order of damage.

Unclear state ownership. When several places can write the same value, no change is safe because the effects are unbounded. This is the most expensive single problem.

Boundaries that are not enforced. A structure that exists in a document but not in tooling erodes, and after a year everything imports everything and nothing can be deleted.

Components with many modes. A component with eight flags has combinations nobody has tested, so every change risks a configuration you did not think about.

Tests coupled to implementation. A suite that breaks on every refactor teaches the team that failures are noise, and then it protects nothing.

What is notably not on the list is the framework, or the age of the code. Old code with clear ownership and enforced boundaries is pleasant to work in; new code without them is not.

Land it Changeability is mostly about how many places can affect one thing, which is why state ownership dominates the list.

Drill · State and data

Fifteen questions on the four kinds of state, caching, and the decisions that turn "which library" into a non-question.

Q16. "Where should state live? Give me your framework for deciding."

Reveal answer

The real test Whether you separate server cache from client state before saying anything about libraries.

Strong answer By first noticing that "state" means four different things with four different owners.

Server cache — products, profiles, search results. The server owns the truth and my copy is a stale snapshot, so it belongs in a caching layer with a freshness policy: a resource in Angular, Server Components or a query library in React.

URL state — page, sort, filters, selected record. The address bar owns it.

Local UI state — a dropdown's open flag, a hovered row, an unsent draft. One component owns it and it should die with that component.

Shared client state — the signed-in user, theme, cart, feature flags. The application owns it, so a service or a small store, scoped to the app or to a feature depending on when it should reset.

Sorting them first means the library question only applies to the fourth kind, which is usually the smallest.

Land it Most state management arguments are really a failure to notice that server data is a cache, not state.

Q17. "Why is putting server data in a global store a problem?"

Reveal answer

Strong answer Because the moment you store it, you have signed up for cache invalidation, and you will end up writing a caching library inside your state library.

The sequence is predictable. Another user edits a record and your copy is wrong. A background job changes a status. The user opens a second tab. So you add refetch-on-navigation, then refetch-on-focus, then a timer, then a growing list of "after this mutation, invalidate these keys".

Each addition is reasonable and the total is a caching implementation that nobody designed and nobody wants to touch.

The alternative treats it as what it is: a cache keyed by its inputs, with a stated freshness policy, automatic refetch when the inputs change, and cancellation of superseded requests. Both ecosystems now provide that out of the box.

Land it The tell that you have made this mistake is a file of invalidation rules — that file is a caching library you did not mean to write.

Likely follow-ups
"Is there a case where server data does belong in a store?"

Yes — when it has been meaningfully transformed into client state. A shopping cart derived from products but with the user's own quantities and selections is client state that happens to reference server data.

Also when the client is the temporary owner: a draft being edited is client state until it is saved, even though it originated from the server. The distinction is who owns the truth right now.

Q18. "What belongs in the URL, and what does that buy you?"

Reveal answer

Strong answer Anything a user would expect to survive a refresh, be restorable with the back button, or be shareable: the open record, page, sort, filters, search term, selected tab.

Not transient UI state such as whether a menu is open, not anything sensitive since URLs appear in server and proxy logs and referrer headers, and not anything large.

What it buys is that three recurring bug reports stop existing — "I refreshed and lost my filters", "the back button went somewhere odd", "I cannot share this view".

Two implementation details matter. Use replace rather than push for continuous changes like typing, or every character becomes a history entry and the back button walks the user through their own typing. And keep parameter names short and stable, because once people bookmark them they are a public interface.

Land it The URL is the only application state a user can read, edit, bookmark and send to someone — which makes it the most valuable place for anything they care about.

Q19. "When do you actually need a state management library?"

Reveal answer

Strong answer Later than most teams reach for one, and only for the fourth kind of state.

The ladder I use is: component state, then a service or a small store when a sibling needs the value and lifting would thread through three layers, then a structured store when the state graph is large or nobody can answer "who changed this", then the full Redux pattern almost never.

The specific pressures that justify moving up are a shared graph that several features mutate, a need for an action log or audit trail, or a team large enough that a hard intent-versus-state boundary is worth the ceremony.

The pressure that does not justify it is "this is what we always use".

What a full Redux-style store buys is an action log, time travel, a strict boundary and a declared effects layer. Adopt it if the team would actually open the timeline; otherwise you are paying for a feature you do not consume.

Land it Every layer of architecture is a cost paid by everyone who joins later, so it should be bought with a specific pain rather than a preference.

Q20. "Describe the shape of a well-designed store, in either framework."

Reveal answer

Strong answer One private writable source of truth, a read-only public view, derived values computed rather than stored, and a small named set of methods that are the only writers.

In Angular that is a private signal with asReadonly() and computed derivations. In React it is a store with selectors, where consumers subscribe to derived values rather than to the whole object.

Two rules make it work. Nothing derived is stored — a count kept as a second field must be maintained everywhere the list changes, whereas a derived count cannot fall out of step because there is no line to forget.

Nothing outside can write directly. A wrong value then has three candidate causes, each ten lines long, rather than forty components that could have mutated the array.

That bounded set of named transitions is most of what a Redux store was ever bought for, without actions or reducers.

Land it The single most valuable line is the read-only public view, and it costs nothing.

Q21 · Scenario. "A component re-renders whenever anything in the store changes. Fix it."

Reveal answer

Strong answer The component is subscribed to the whole store rather than to what it reads, and the fix is granularity.

In React that means selectors: useStore(s => s.cart.length) subscribes to the derived number, so an unrelated field changing does not re-render. Calling the hook with no selector subscribes to everything, which is the usual cause.

In Angular it means exposing computed values rather than the raw state signal, so a component reads count() and is unaffected by changes that leave the count identical.

There is also a modelling cause worth checking: a store that holds one large object cannot be subscribed to precisely by anyone, whatever the library. If every field lives in one blob, the fix is to split the state rather than to work around it.

I would confirm with the framework's profiler first, since "re-renders too much" is often an assumption rather than an observation.

Land it Expose what consumers read, not the object they read it from — that is the whole of subscription granularity in both frameworks.

Q22. "How do you design a caching strategy for server data?"

Reveal answer

Strong answer By deciding four things explicitly, because the defaults of any library are a guess about your data.

The cache key. Everything the request depends on, so two different filters are two entries and cannot serve each other's data.

Freshness. How long a cached value may be served without refetching. Reference data can be minutes; a live balance is seconds or zero.

Revalidation triggers. On mount, on window focus, on reconnect, on an interval. Refetch on focus covers most of the "I switched tabs and it was stale" complaints for a few lines.

Invalidation after mutations. Explicit rather than time-based: after a save, reload what could have been affected.

The rule that keeps it sane is that the cache must never be stale immediately after the user's own action. Everything else is tuning; that one is a correctness requirement.

Land it Before any of this, check whether HTTP caching headers can do the job — they cost no application code and work across tabs and reloads.

Q23. "What are optimistic updates and when are they wrong?"

Reveal answer

Strong answer Applying a change locally before the server confirms it, then reconciling — replacing with the server's response on success, or rolling back on failure.

They are right for actions that almost always succeed and are cheap to undo: a like, a checkbox, reordering a list, marking something read. The interface feels instant and the rare rollback is tolerable.

They are wrong for anything with a real-world consequence. A payment, a delete, an irreversible submission — there, showing success and then retracting it is worse than a spinner, and users lose trust in the system's reports.

Three things go wrong when they are used. Rollback is jarring if the user has moved on. Concurrent optimistic updates can restore a stale snapshot and undo each other, so reconciliation should be per item rather than per list. And server-assigned values — ids, totals, timestamps — are not known optimistically, so anything keyed on them needs a temporary placeholder.

Land it The test is whether being wrong for two seconds is cheap; if it is not, the honest spinner is the better design.

Q24 · Scenario. "Two components fetch the same data on the same page. Two requests go out. Fix it."

Reveal answer

Strong answer The data is being modelled as an action each component takes rather than as a shared cache entry, and the fix is at that level rather than by coordinating the components.

With a query library, both components use the same query key and get one request and one cache entry automatically — that is the primary reason those libraries exist.

In Angular, both should read the same resource, exposed from a service, rather than each creating its own or calling a method that returns a cold observable. A method returning a cold observable will always do this, since every subscriber gets its own execution.

The general principle is that a service should expose state, not fetchers. Handing out cold observables makes every consumer responsible for deduplication, and they will not all remember.

If a fetcher genuinely must be shared, the pattern is an in-flight promise or observable held on the service and returned to concurrent callers.

Land it Deduplication belongs in the layer that owns the data, not in the components that happen to want it at the same moment.

Q25. "How do you handle pagination — offset or cursor?"

Reveal answer

Strong answer Cursor-based whenever the underlying data changes while people are reading it, offset when it does not and users need to jump to a specific page.

The failure with offset pagination is concrete: if a record is inserted before your position between two page requests, page two starts one record earlier than it should, so one row is shown twice and one is skipped entirely. On a feed with constant inserts this is not an edge case, it is normal.

Cursor pagination passes an opaque pointer to the last item seen, so inserts elsewhere cannot shift the window. The cost is that you cannot jump to page seven, only forward and back.

So the decision is really about the interface: a "load more" or infinite feed wants cursors; a table with numbered pages needs offsets and accepts the shifting.

On the frontend, either way, the page state belongs in the URL, and the previous page should stay visible while the next loads rather than flashing empty.

Land it Choosing offset because the interface has numbered pages is fine; choosing it by default on a live feed produces duplicate and missing rows that look like a backend bug.

Q26. "How would you implement infinite scroll well?"

Reveal answer

Strong answer With an IntersectionObserver on a sentinel element after the last item, cursor-based paging, and several things that are usually missed.

Do not let the DOM grow without bound. Ten pages of fifty rows is five hundred nodes' worth of memory and layout cost; either virtualise, or the page degrades as the user scrolls.

Preserve scroll position on back navigation, or a user who opens an item and returns is sent to the top of the list, which is the most complained-about behaviour in this pattern.

Provide an explicit load-more fallback, because automatic loading is difficult for keyboard and screen reader users, and because an infinite list makes a page footer unreachable.

Handle the end — say when there are no more results rather than spinning forever.

And I would ask whether it is the right pattern at all. For a task-oriented list where people look for a specific item, pagination with search is usually better; infinite scroll suits browsing, not finding.

Land it The unreachable footer and the lost scroll position are the two failures that make users describe an otherwise smooth feed as broken.

Q27. "How do you keep two tabs of the same application consistent?"

Reveal answer

Strong answer First by recognising that inconsistency is the default: each tab is a separate JavaScript context with its own state and caches, and nothing is shared unless you share it.

Then, in increasing order of cost: refetch on window focus, which covers most of the perceived problem in a few lines; the storage event, which fires in other tabs when localStorage changes and is enough to say "something changed, refetch"; BroadcastChannel, which is the purpose-built messaging API for same-origin tabs; and a server push, which is the only one that also handles changes made by other users.

The framing that matters is that this is cache invalidation, not a tab problem. If the data is server-owned, the general answer — refetch on focus plus a push when the server changes it — solves the two-tab case as a side effect.

The case that genuinely needs cross-tab messaging is logout, where every tab must clear state immediately.

Land it Two tabs is not the hard case — two devices is, and designing for that makes the tab case fall out for free.

Q28. "What state should survive a page refresh, and how would you persist it?"

Reveal answer

Strong answer Three categories, with three different mechanisms.

Anything shareable — filters, page, the open record — belongs in the URL, which persists for free and is also linkable.

Anything the user would be upset to lose — a half-written form, an unsent message — should be autosaved to local storage as a draft, keyed by user and form, and cleared on successful submit.

Preferences — theme, density, a chosen layout — belong in local storage, and ideally on the server too so they follow the user to another device.

What should not persist is anything derived from the server, because a stale copy restored on load is worse than a fresh fetch. And nothing sensitive, since local storage is readable by any script that gets injected.

One implementation detail: preferences that affect the first paint, such as theme, must be applied before rendering, or the user sees the wrong one flash on every load.

Land it Autosaved drafts are the highest-value persistence work, because one mechanism covers session expiry, accidental navigation, a closed tab and a crash.

Q29. "How do you model a form's state — and is form state one of the four kinds?"

Reveal answer

Strong answer Form state is local UI state while it is being edited, and becomes a server mutation when it is submitted. Treating it as either one exclusively causes problems.

Treating it as pure local state loses the draft on navigation, which is why autosave matters. Treating it as server state — patching the server on every keystroke — produces enormous request volume and a record that is invalid halfway through editing.

So the model I use is: the form owns the values while editing, one submit produces one mutation, and a debounced draft is persisted locally in between.

The related decision is where the form object lives. In a component is right for a single-screen form; in a route-scoped service for a wizard, so every step shares one form and leaving the flow clears it.

And the values that identify which record is being edited belong in the URL, not the form, so a refresh returns to the same record.

Land it The useful framing is that a form is a local staging area for a future mutation, which explains both why it should be autosaved and why it should not be synchronised.

Q30 · Design. "Design the data layer for a dashboard with twelve independent panels."

Reveal answer

Strong answer The requirement I would establish first is whether panels are genuinely independent, because that decides everything else.

Assuming they are: one cache entry per panel, keyed by the panel's own parameters, so each renders as soon as its own data arrives rather than waiting for the slowest.

Render progressively — twelve panels appearing over three seconds feels far better than a blank page for four, and it is also more resilient because one failure is one panel rather than the page.

Do not fetch what is not visible. Panels below the fold go behind a viewport trigger, which removes their requests from the initial load entirely — usually the single biggest win.

Bound the concurrency. Twelve simultaneous requests hit the browser's per-host connection limit and queue anyway; loading visible ones first is faster than firing all twelve.

Share what is shared. If eight panels need the same date range and organisation, that is one cache entry read by eight, not eight requests.

What I would avoid is a single aggregate endpoint returning everything: it becomes the slowest panel's latency for every panel, and it fails as a unit. A server-side gateway that fans out is the middle ground if round trips are the bottleneck.

Land it Independent panels should fail and succeed independently, which is as much an error-handling decision as a fetching one.

Likely follow-ups
"The user changes the global date filter. What happens?"

The filter is part of every panel's cache key, so changing it invalidates all twelve and each refetches — which is correct, but twelve simultaneous requests and twelve spinners is a poor experience.

I would keep the previous data visible with a subtle loading indication rather than clearing to skeletons, since the shape of the dashboard does not change. And I would debounce the filter if it is a range picker that emits during dragging.

Drill · Rendering, delivery and the build

The last fifteen of the architecture block: where HTML comes from, what ships to the browser, and how a codebase stays deployable.

Q31. "Walk me through the rendering strategies and how you would choose."

Reveal answer

Strong answer Four places HTML can be produced, and the choice is decided by two questions.

Client-side — produced in the browser after JavaScript runs. Worst first paint, no server, invisible to crawlers without JavaScript.

Static — produced at build time. Best first paint, served from a CDN, cannot be personalised without rebuilding.

Server-side — produced per request. Fast first paint with personalisation, at the cost of a server to run and scale and a class of server-only bugs.

Incremental or edge — rendered once, cached, revalidated in the background. Best for large catalogues where most pages change rarely.

The two questions: is it behind a login, and is the content the same for everyone. Behind a login means client-side is almost certainly right. Same for everyone means prerender. Public and personalised means server-render.

One application usually mixes all three — prerendered marketing, server-rendered catalogue, client-rendered authenticated app.

Land it Turning on server rendering for an internal tool is the common mistake: a server to operate and a class of bugs, for a benefit nobody in that audience experiences.

Q32. "What is hydration and why does it matter to a user?"

Reveal answer

Strong answer Hydration is the client-side framework adopting server-rendered HTML — walking the existing DOM, matching nodes to the components that would have produced them, and attaching event listeners.

It matters because of the gap it creates. The page looks completely ready and responds to nothing until hydration finishes. Users click, nothing happens, they click again — and that is measured by Interaction to Next Paint, not by first paint.

Full hydration has to download and execute the JavaScript for the entire page before anything is interactive, so a large page can look ready for a second or more while being inert.

The answers narrow the gap from different directions: Angular defers executing a block's code until a trigger with incremental hydration; React Server Components avoid sending the code at all for components that do not need interactivity.

Land it Server rendering moves the content marker left; only incremental hydration or Server Components move the interactive marker left too.

Likely follow-ups
"What causes a hydration mismatch?"

The client rendering something different from what the server produced. Three common causes: invalid HTML nesting that the browser silently corrects, so the server's string and the parsed DOM differ; values that differ between environments such as a timestamp or a random number; and reading browser-only state to decide what to render.

The framework reports it and falls back to re-creating that subtree, which produces a visible flicker and cancels much of the benefit.

Q33. "Explain React Server Components to someone who has only used Angular."

Reveal answer

Strong answer A Server Component's function runs only on the server. It can query a database directly, use secrets, and import a large library — and none of that code is sent to the browser. What is sent is its rendered output.

Interactive parts are opt-in islands marked 'use client', and those do ship.

The Angular comparison is honest and worth making: Angular renders the whole tree on the server and then hydrates it on the client, so the component's code ships either way. Incremental hydration defers executing it; Server Components avoid sending it.

That is a real architectural difference and the biggest one between the ecosystems in 2026.

It is not free. It requires a server-rendering framework, it adds a boundary developers get wrong — passing a function across it fails — and it makes "where does this run" a question every developer holds constantly.

Land it The gain is that code which only formats or queries never reaches the browser at all, which is a category of bundle saving Angular currently has no equivalent for.

Q34. "What is streaming and how does it change page design?"

Reveal answer

Strong answer Streaming sends the page in pieces as they become ready, rather than waiting for all data before sending anything.

The design consequence is significant: the slowest data no longer sets the page's speed. A dashboard whose analytics panel takes two seconds can still deliver its header, navigation and three fast panels at two hundred milliseconds.

In React that is <Suspense> with a fallback — the shell streams immediately and each slow region's markup arrives later and replaces its skeleton.

To get the benefit you have to design the skeletons deliberately. A skeleton that is a different size from the content it replaces converts a speed win into a layout-shift regression, which is a worse trade than it looks.

And the page structure has to make sense progressively: navigation and the primary heading should be in the first chunk, so the user can act before the slow parts land.

Land it Streaming turns a page from one unit into a set of independently-arriving regions, which is a layout decision as much as a technical one.

Q35. "How do you decide what to code-split?"

Reveal answer

Strong answer By what most users do not need on the first screen.

The reliable splits, in order of yield: every top-level route, so a user visiting two of twelve features downloads two; heavy components below the fold — charts, editors, maps — which often dominate a bundle while being irrelevant to most visits; and rarely-used modals and flows, which load on the interaction that opens them.

What I would not split is anything needed for the first render, since a split there adds a round trip to the critical path and makes things worse.

The measurement step matters: after splitting, look at the emitted chunks. A split that produced no separate chunk — usually because the component is also referenced eagerly elsewhere — is decoration.

And splitting has a cost per chunk in round trips, so hundreds of tiny chunks is its own problem; the tooling generally handles this by merging small ones, but it is worth checking.

Land it Split by what users do not need yet, then verify against the emitted chunks rather than assuming the split worked.

Q36 · Scenario. "Your initial bundle is 1.8 MB. Walk me through getting it down."

Reveal answer

Strong answer Look before cutting: a bundle analyser on a production build, because the biggest rectangle is usually a surprise and the biggest win is usually one dependency.

Then in order of typical yield. Lazy-load every feature route — on an application with a dozen features this alone often halves it, and it is mechanical.

Fix the dominant dependency. The recurring causes are a namespace import of a utility library, a date library including every locale, an icon package imported through a barrel so nothing tree-shakes, a package with no ES-module build, and two versions of the same library in the tree.

Defer heavy in-page components behind a viewport or interaction trigger.

Check the shared module — a "shared" module that acquired a feature dependency drags that feature into everyone's initial chunk.

Then set a size budget just above the achieved number so it cannot regress silently, and verify on a throttled profile rather than trusting the build output.

Land it Almost every oversized bundle is two or three specific decisions rather than general bloat, which is why measuring first saves days.

Likely follow-ups
"The biggest item is a library you cannot remove."

First check whether it ships an ES-module build, since a CommonJS-only package cannot be tree-shaken by anyone — sometimes a maintained alternative or fork exists.

If it must stay whole, isolate it behind a lazy route or a defer boundary so only the users of that feature pay for it. And check for duplication, since two versions of the same library is common and doubles the cost for nothing.

Q37. "What is tree-shaking and what defeats it?"

Reveal answer

Strong answer Removing code the bundler can prove is unreachable. It relies on static ES-module imports, because the bundler must be able to see at build time exactly what is used.

Four things defeat it. Namespace imports — import * as x means everything is potentially referenced. CommonJS packages, whose exports are computed at runtime and cannot be analysed. Side effects in modules, since a module that does something on import cannot be dropped even if its exports are unused — which is why sideEffects: false in a package manifest matters.

Barrel files, where one index re-exports a hundred modules and importing one thing makes the bundler evaluate the graph of all of them; modern bundlers handle this better than they used to but it is still a common cause.

The related framework point is that Angular's providedIn: 'root' exists partly for this: putting registration on the class rather than in a module's providers array lets a bundler prove an uninjected service is unreachable.

Land it Tree-shaking is a proof, not a heuristic — anything that makes the usage dynamic makes the proof impossible and the code ships.

Q38. "How do you handle environment configuration in a frontend?"

Reveal answer

Strong answer By fetching it at runtime rather than compiling it in, so one artefact can be promoted through environments.

Compiling configuration into the bundle means staging and production are different builds, and you cannot deploy the exact bytes you tested. It also makes values invisible to dependency injection, so they cannot be overridden in a test without module mocking.

The approach I prefer is a small configuration document served from the same origin, fetched at startup and provided through the framework's injection mechanism. It costs one request on first load and can be cached.

The critical rule regardless: nothing secret goes in frontend configuration. Everything in the bundle and everything the bundle fetches is public. An API key in a frontend is a published API key, whatever route it sits behind.

If a secret is genuinely needed, the call goes through your own server, which holds it.

Land it Build once, deploy many is the reason to prefer runtime configuration, and it is also what makes a rollback a redeploy rather than a rebuild.

Q39 · Scenario. "After a deploy, users with the old page get errors clicking into a lazy route. Why?"

Reveal answer

Strong answer Their loaded application references chunk filenames containing the old content hashes. The deploy replaced them, so the request 404s and the dynamic import rejects — the navigation silently does nothing, or throws.

Three fixes, and a good answer names more than one.

Keep old chunks available for a grace period rather than deleting them on deploy. This is the actual fix; the rest are mitigations for the window you cannot avoid.

Catch the failed chunk load and reload the page once, guarded by a session flag so a genuinely broken chunk cannot cause an infinite reload loop, and not while the user has unsaved work.

Notify the user that a new version is available and let them choose when to reload — important for applications where people keep a tab open for hours.

The same class of problem applies to a service worker serving a cached old shell, which is why an update path matters there too.

Land it Deleting old chunks on deploy is the defect; a silent reload that discards a half-written form is a worse cure than the disease.

Q40. "When are micro-frontends the right answer?"

Reveal answer

Strong answer When independent teams must deploy on independent schedules and are genuinely blocked on each other's releases today. It solves an organisational problem, not a technical one.

If a monorepo with enforced boundaries would remove the blocking, that is cheaper in every dimension.

The costs are substantial and worth naming. Framework version alignment: every remote must agree on the major version, so upgrades become a cross-team negotiation — often more coupling than the arrangement was meant to remove. Shared state needs an explicit contract across the boundary. Bundle size grows because sharing is imperfect. Debugging spans applications, and end-to-end testing needs the whole composition running.

So I would consider them for a large organisation with separately deployable products, and push back for a single product with several teams — where they usually get adopted for the wrong reason.

Land it Teams adopt micro-frontends for independence and discover they are more coupled at upgrade time than they were in one repository.

Q41. "What belongs in a backend-for-frontend, and when is one justified?"

Reveal answer

Strong answer A backend-for-frontend is a thin server owned by the frontend team that shapes data for one client.

It is justified when the frontend is making many round trips to compose one screen, when it needs to hold a secret to call a third party, or when several downstream services must be aggregated and the browser is the wrong place to do it — because it is far from the data and on a slow connection.

What belongs in it: aggregation, shaping, and secret-holding. What does not: business rules, which belong in the domain services, or it becomes a second backend with no ownership.

The cost is another deployable to run, monitor and version, and a temptation to accumulate logic. The mitigation is a rule that it may not contain a decision the domain services could make.

Server Components and server-side rendering blur this: a rendering server that queries several services is doing much of a backend-for-frontend's job already.

Land it Aggregation and secrets, never business rules — that boundary is what keeps it a thin layer rather than a second system.

Q42. "How do you version and evolve a shared component library?"

Reveal answer

Strong answer With semantic versioning taken seriously, and with the migration burden treated as the library's problem rather than the consumer's.

The mechanics: a changelog per release; deprecation warnings at least one minor version before a removal; and a codemod or schematic for every breaking change, because five teams cannot all migrate on the same day.

Beyond that, two things decide whether teams stay current. Test harnesses, so consumers' tests do not break when internal markup changes — otherwise the first team that gets burned pins the version and stops upgrading. And a stated policy for what does not belong, so the library does not accumulate domain knowledge that couples it to one product.

I would also publish a canary or next channel, so a team can validate an upcoming change against their application before it is released.

Land it A library without harnesses and migrations gets pinned, and a pinned library has failed regardless of how good the components are.

Q43. "What would you put in CI for a frontend project?"

Reveal answer

Strong answer Six gates, ordered so the fast ones fail first.

Type checking and lint, which take seconds and catch the most. Unit and component tests. A production build, since a build that only works in development is a deploy waiting to fail.

Bundle size budgets, which is the gate people leave out and regret, because bundle growth is completely invisible in code review.

End-to-end tests for the small set of critical journeys, run against the production build.

An accessibility check — a linter on templates plus an automated audit — which catches perhaps a third of issues for free on every commit.

Beyond gates, a Web Vitals or Lighthouse run on representative pages tracked as a trend rather than a hard gate, because it is noisy but the trend is real.

Land it Anything not defended by automation is undone within two quarters, which is why the budget in the build matters more than any single optimisation.

Q44. "How do you monitor a frontend in production?"

Reveal answer

Strong answer Three streams that answer three different questions.

Is it broken? A global error handler reporting with route, user, release version and a correlation id, plus unhandled promise rejections which are missed by default. Source maps uploaded per release, or every stack trace is minified noise. Alert on error rate per release so a bad deploy shows within minutes.

Is it slow? Core Web Vitals from real sessions, segmented by device and connection, reported at the 95th percentile rather than averaged. Laboratory numbers on fast hardware miss the population that matters.

Does it work? Funnel completion for the main journeys, because a page that renders perfectly and where nobody completes checkout is broken in the way that counts.

Tie all three together with the release identifier and a correlation id shared with backend traces, so a frontend error can be followed to the request that caused it.

Land it Without source maps and a release identifier, production error reporting produces volume rather than information.

Q45 · Design. "Design the frontend architecture for a product with 40 screens and 15 engineers."

Reveal answer

Strong answer At that size the problem is coordination, not code, so I would optimise for independent work and enforced boundaries.

Structure by feature, each owning its components, state and routes, and each behind its own lazy route so the folder and the chunk are the same boundary.

Enforced import rules — features may import from shared and core, shared from neither, features not from each other — as lint rules rather than documentation.

A design system as its own versioned library, so fifteen people are not each styling a button, with harnesses and migrations so teams stay current.

State by kind: server data in a caching layer, URL state in the URL, feature state scoped to its route, and a few ambient stores. No global store unless the action log would genuinely be used.

Conventions that remove decisions — a standard component shape, a standard store shape, standard loading and error treatments — so reviews are about behaviour rather than structure.

What I would avoid: micro-frontends, which are an organisational solution to a problem fifteen people in one repository do not have.

Land it The single test for whether the boundaries are real is whether deleting a feature means deleting one folder.

Likely follow-ups
"How do you keep 40 lazy chunks from duplicating shared dependencies?"

The build extracts common code into shared chunks automatically, so a library used by three routes is emitted once. What breaks that is inconsistent versions — two features depending on different versions genuinely does duplicate it.

A single lockfile and a shared dependency policy prevent it, and the bundle analyser makes it visible when it happens anyway.

13 · DrillAngular vs React — Q46–Q90

These forty-five questions are the ones asked when a company uses one framework and you have used the other, or when they want to know whether your opinions are informed.

The standard being applied is not which you prefer. It is whether you can explain each framework's model accurately, name what each is genuinely better at, and avoid attributing to a framework something that is simply true of rendering data on a screen.

Drill · The two rendering models

Fifteen questions on how each framework decides what to update, and what follows from that difference.

Q46. "Explain how React and Angular each decide what to re-render."

Reveal answer

The real test Whether you can describe both accurately rather than caricaturing the one you use less.

Strong answer React re-runs the component function to produce a description of the UI, diffs that description against the previous one, and applies the differences. The unit is the component: re-rendering means calling it again, including everything in it.

Angular compiles each template into an update function with a fixed set of binding slots. A check re-evaluates those expressions and compares each against its stored slot, writing to the DOM only on a difference. There is no intermediate tree and no diff.

The practical consequence is where granularity lives. In React, a re-render re-runs everything in the component, which is why memo, useMemo and useCallback existed — and why the React Compiler now inserts that memoisation for you.

In Angular, a check re-evaluates bindings but does not re-run the class, so component state is not recreated and there is no equivalent of the stale-closure problem.

Both are converging on fine-grained reactivity — Angular through signals, React through its compiler — from opposite starting points.

Land it The vocabulary difference reflects history rather than a difference in what is possible today, and saying so is more accurate than claiming either model wins.

Q47. "What is the React Compiler and what does it change?"

Reveal answer

Strong answer It is a build-time tool, at 1.0, that analyses components and inserts memoisation automatically — the work you used to do by hand with useMemo, useCallback and React.memo.

What it changes practically is that the most common category of React performance bug largely disappears. Forgetting to memoise a callback, so a memoised child re-rendered anyway, was a defect you had to know about; now the compiler handles it.

It also removes a large amount of noise from component code, since dependency arrays were both tedious and a source of subtle bugs when they were wrong.

What it does not do is fix architectural problems: a component subscribed to a whole store, or a context whose value changes on every render, still re-renders too much, because the issue is what it depends on rather than whether the result is memoised.

In interview terms, it closes most of the predictability gap that made Angular's model feel more controlled, and it is worth acknowledging that.

Land it It removes the manual memoisation burden, not the need to think about what a component depends on.

Q48. "Compare Angular signals with React hooks for holding state."

Reveal answer

Strong answer Both hold a value and notify on change; the difference is what the notification triggers and what happens to the surrounding code.

useState triggers a re-render of the component, which re-runs the whole function body. State survives because React associates it with the component instance by call order, which is why hooks cannot be called conditionally.

signal notifies exactly the consumers that read it — which may be one binding in one template — and does not re-run the component class at all.

Derivation differs correspondingly. computed is lazy and cached automatically and tracks its dependencies from actual reads. useMemo requires an explicit dependency array, which can be wrong, though the compiler now handles most cases.

The consequence that matters for correctness: because React re-runs the function, closures capture that render's values, which is the source of the stale-closure family of bugs. Angular's class methods read current values, so that category does not exist.

Land it Signals are finer-grained by construction; hooks are simpler to compose because everything is just a function call — and each pays for its choice somewhere.

Likely follow-ups
"What is a stale closure, concretely?"

A callback created during one render captures the values from that render. If it is registered once — in an effect with an empty dependency array, or passed to a timer — it keeps reading the old values forever.

The classic version is a setInterval in a mount-only effect logging a counter: it logs zero forever, because the closure captured the initial state. The fixes are a functional update, a ref holding the latest value, or useEffectEvent.

Angular has no equivalent because the method reads this at call time, and a signal read always returns the current value.

Q49. "Compare Angular's dependency injection with React's context."

Reveal answer

Strong answer They solve the same problem — getting a shared thing to a deep component without threading props — with different mechanisms and different power.

Angular's DI is a hierarchical registry keyed by tokens. It controls instance lifetime, supports substitution with useClass and useFactory, resolves through a defined chain, and is available outside components entirely — in guards, interceptors and other services.

React's context is a value passed down the tree. It is simpler, has no lifetime semantics of its own, and is only readable inside components.

The practical differences: Angular's DI makes testing substitution a one-line provider change, and makes "this service resets when you leave the feature" a configuration decision. React achieves the equivalent by rendering a provider at the right place in the tree, which works but is less explicit.

Context also has a performance characteristic worth knowing: every consumer re-renders when the value's identity changes, so an object literal as a context value re-renders everything on every parent render. That is why React applications often use a store library instead, which supports selectors.

Land it Angular's DI is more powerful and more to learn; context is simpler and needs a store beside it once granularity matters.

Q50. "How do the two frameworks handle list identity, and what happens when you get it wrong?"

Reveal answer

Strong answer Identically in effect: React's key and Angular's track both tell the framework which old rendered item corresponds to which new data item.

With a stable identity, reordering is a DOM move. Without one, the framework cannot recognise anything, so it destroys and rebuilds rows.

The symptoms are specific and shared: focus jumps out of an input mid-typing, checkbox state resets, scroll position is lost, animations restart, and a hundred rows re-render to move one.

Two differences worth naming. Angular requires track and fails the build without it, whereas React only warns about a missing key — so the Angular version of this bug is a wrong track expression rather than an absent one.

And duplicate keys behave differently: Angular throws a runtime error naming the duplicated value; React warns and produces undefined behaviour in the reconciliation.

Both degrade the same way when you use the array index on a list that can reorder or have items removed from the middle.

Land it This is the clearest example of a "framework" question that is really one problem with two spellings.

Q51. "How does each framework handle side effects, and what are the failure modes?"

Reveal answer

Strong answer React's useEffect runs after render, with an explicit dependency array deciding when it re-runs, and an optional cleanup returned from it.

Angular's effect runs after the render too, but tracks its dependencies automatically from the signals it reads, and receives a cleanup registration callback.

The failure modes differ accordingly. React's is the wrong dependency array — too few and it captures stale values, too many and it re-runs constantly. This is why the compiler and the linter matter so much there.

Angular's is accidental dependencies: a signal read incidentally makes the effect re-run when it changes, which is what untracked is for.

Both share the biggest failure, which is using an effect for derivation. An effect that reads one value and sets another is a computed written the hard way — it runs later, it can loop, and it hides the relationship. React's documentation and Angular's warnings both push against it.

Land it In both frameworks the rule is the same: if the effect ends by setting state, you wanted a derived value.

Q52. "Templates versus JSX — what does each buy?"

Reveal answer

Strong answer JSX is JavaScript, so anything you can do in the language you can do in the view: map, extract a variable, pass an element as a value, build a component conditionally. The composition model is uniform and there is nothing extra to learn.

Angular templates are a restricted language, and the restrictions buy things. The compiler knows the whole structure, so it generates a fixed set of binding slots and needs no diff. It can type-check bindings against the class. And expressions cannot have side effects, which prevents a category of bug that JSX permits.

The cost is that dynamic structure needs specific mechanisms — ng-template, ngTemplateOutlet, dynamic component creation — where JSX just passes a function.

The other real difference is separation: templates in their own files keep markup out of TypeScript, which some teams value and others find is just a second file to open.

I would not claim either is better. The template model gives predictability and tooling; JSX gives uniformity and flexibility.

Land it Angular's template type checking is the underrated part — renaming a property and having every template fail to build is not something JSX projects get for free without strict typing throughout.

Q53 · Scenario. "A React component re-renders on every keystroke in an unrelated input. Diagnose."

Reveal answer

Strong answer Something makes them share a render boundary, and there are three usual causes.

State is too high. The input's value lives in a parent that also renders the unrelated component, so every keystroke re-renders the whole subtree. The fix is to push the state down into the input's own component, or to isolate the parts that do not depend on it.

A context value changing identity. If the parent provides an object literal as a context value, every render creates a new identity and every consumer re-renders regardless of what changed.

A store subscribed without a selector, so the component depends on the whole store rather than the field it reads.

I would confirm with the React DevTools profiler, which shows why each component re-rendered — props changed, state changed, context changed — rather than guessing.

With the compiler enabled, the memoisation causes largely disappear and what remains is the architectural ones, which are the first and third.

Land it "Why did this render" is a question the profiler answers directly, and it distinguishes a missing memo from state living in the wrong place.

Q54. "How does each framework do routing, and what differs?"

Reveal answer

Strong answer Angular ships a router, versioned with the framework: a routes array, guards, resolvers, lazy loading, and parameters bindable as component inputs.

React has no official router; the ecosystem provides them, and the meta-frameworks provide file-based routing where the folder structure is the route table.

The capabilities have converged. Both do nested routes, lazy loading, guards or their equivalent, and data loading tied to a route.

Two differences remain worth naming. Angular's is one implementation that every Angular developer knows, which matters for onboarding. React's file-based routing is more discoverable — the routes are visible in the directory listing — and its data loading patterns are more tightly integrated with server rendering.

The failure mode differs too: in React the risk is a project using an unusual routing library that nobody else knows; in Angular the risk is a project not using the router's modern features, so route parameters are still read from snapshots.

Land it This is the clearest example of the framework-versus-library trade: one answer everyone knows, versus the freedom to choose and the obligation to.

Q55. "How do forms compare between the two?"

Reveal answer

Strong answer Angular ships two form systems — reactive and, since v22, Signal Forms — with validation, state flags and typed values in the framework.

React has none, and the ecosystem answer is a library such as React Hook Form, usually paired with a schema validator.

The capability difference is small; the trade is familiar. Angular's is one approach everyone knows, integrated with the framework's change detection and testing. React's is a choice per project, and the libraries are excellent but the team has to make the decision and live with it.

One genuine technical difference: React's uncontrolled-input approach, which the popular libraries use, avoids re-rendering on every keystroke by reading values from the DOM at submit time. That makes large forms fast by default, where a naive controlled implementation re-renders the form on every character.

Angular's reactive forms have the mirror-image issue — a subscription to the whole group's value changes doing work on every keystroke — with the same fix of subscribing narrowly or updating on blur.

Land it Both ecosystems arrive at the same answer for large forms: do not do work on every keystroke, whatever the mechanism.

Q56. "What does Angular give you that React does not, honestly?"

Reveal answer

Strong answer Five things, and I would be specific rather than saying "batteries included".

A versioned set of decisions. Router, forms, HTTP client, testing and build tool ship together and upgrade together, so there is no dependency matrix to maintain and no research phase per project.

Hierarchical dependency injection, which gives lifetime control and substitution that context does not.

Template type checking, catching binding errors at build time.

Official migration schematics, so major upgrades are largely mechanical — this is a real and under-appreciated advantage at scale.

Consistency across a large team, because the framework has already decided most of what a team would otherwise debate.

The honest cost is a steeper first fortnight and less flexibility when you want to do something unusual.

Land it The value compounds with team size and product lifetime, which is exactly why Angular concentrates in enterprises and long-lived products.

Q57. "What does React give you that Angular does not, honestly?"

Reveal answer

Strong answer Five, with the same specificity.

Server Components, which keep code out of the browser entirely rather than deferring its execution. Angular has no equivalent today.

A much larger ecosystem, so for almost any need there is a mature, maintained library — and more answers, examples and people who have solved your problem.

A simpler core model. A component is a function; composition is function composition. There is less to learn before being productive.

Flexibility. Nothing is prescribed, so an unusual requirement is a choice rather than a fight with the framework.

A larger hiring pool in most markets, which is a real engineering consideration rather than a popularity contest.

The honest cost is that every project makes the same set of decisions again, and two React codebases can look nothing alike.

Land it Being able to argue for the framework you do not use is what makes your argument for the one you do use credible.

Q58. "Which would you choose for a new product, and how would you decide?"

Reveal answer

Strong answer I would refuse to answer it as a technical question first, because the deciding factors are usually not technical.

Hiring. Which do people in this market know? A framework you cannot staff is a bad choice however good it is.

Existing skills. A team fluent in one ships faster in it for at least two quarters.

Product shape. Many screens, forms-heavy, long-lived, several teams — Angular's included decisions earn their keep. Unusual interfaces, a content-heavy public site, a need to pick best-of-breed libraries — React with a meta-framework has the stronger story.

Ecosystem dependencies. If the product needs a specific library that exists in one ecosystem, that often settles it.

Technically they have converged: both do fine-grained reactivity, both do server rendering and streaming, both have mature tooling. The difference is how much is decided for you, and which is better depends on how many people are deciding.

Land it An answer that lists framework features fails this question; one that names hiring, skills and product shape before anything technical passes it.

Q59. "You are an Angular developer joining a React team. What would you find hardest?"

Reveal answer

Strong answer Four things, and naming them accurately is the point of the question.

The absence of decisions. No prescribed router, forms library, state approach or folder structure, so the first week is learning this team's choices rather than the framework's.

Re-render semantics. Coming from a model where a check re-evaluates bindings, the fact that the whole function body re-runs — and that closures capture that render's values — is the genuinely new idea.

Effects and dependency arrays, which are the source of the bugs a newcomer writes, though the compiler has reduced this considerably.

Missing DI. Reaching for a hierarchical injector and finding context plus a store library takes adjustment, particularly around testing substitution.

What I would find easy: components, props and events map directly; JSX is quick to read; and the architectural thinking — state kinds, boundaries, rendering strategy — transfers completely.

Land it The framework knowledge takes a fortnight; the architectural judgment transfers on day one, and that is the part being hired for.

Q60. "And a React developer joining an Angular team?"

Reveal answer

Strong answer Also four, and they are not the mirror image.

Dependency injection is the biggest genuinely new concept — the injector hierarchy, provider scoping, and the fact that where a service is provided decides how many exist and when they die.

RxJS in older code. Signals cover most new work, but any established codebase has observables, and the flattening operators are a real body of knowledge.

The template language, which is a restricted dialect with its own control flow rather than JavaScript, so some habits do not transfer.

Change detection — understanding what marks a component dirty, and why a mutated object does not.

What is easy: signals map closely onto modern React state thinking, inputs and outputs map onto props and callbacks, and the CLI removes the configuration work entirely.

The common failure I would warn about is fighting the framework — trying to reproduce React patterns rather than using DI and templates as intended, which produces code neither community recognises.

Land it Angular's learning curve is front-loaded and flat afterwards; React's is gentle at first and paid later in per-project decisions.

Drill · Patterns that exist in both, spelled differently

Thirty questions where the interviewer wants to know whether you can implement a known pattern in whichever framework they use.

Q61. "How do you share behaviour between components in each framework?"

Reveal answer

Strong answer React: a custom hook. Any function starting with use that calls other hooks — useDebounce, usePagination, useOnClickOutside. It is the primary reuse mechanism and it composes freely.

Angular: three options depending on what is being shared. A service for logic and state. A directive for behaviour attached to an element — autofocus, click-outside, an analytics tracker. And since Angular 15, host directives, which let a component compose behaviours without the caller applying them.

There is also the emerging pattern of an injectable function that creates and returns signals, which is essentially a hook — createPagination() called in an injection context.

The genuine difference is that React's mechanism is uniform — everything is a function — while Angular's is chosen by what kind of thing you are sharing. Angular's directive option has no React equivalent, and is the better fit when the behaviour attaches to arbitrary elements.

Land it Directives are the reuse mechanism React developers most often miss in Angular, because a component forces a wrapper element and a directive does not.

Q62. "Implement a debounced search in both frameworks."

Reveal answer

Strong answer The two requirements are separate and both must be met: debouncing reduces requests, cancellation fixes ordering.

Angular: a debounced(query, 250) signal read inside an httpResource's URL function. The debounce handles the first requirement; the resource cancelling superseded requests handles the second, with no code.

React: a debounced value in state, used as part of a query key. The query library cancels the in-flight request when the key changes, via an abort signal passed to the fetch.

Without a library, a useEffect with a timer and an AbortController in its cleanup does both — the cleanup cancelling the previous request is the part people omit.

The bug being tested for is using debouncing alone. A slow request fired 250 milliseconds ago can still land after a fast one fired now, so the search box shows results for a prefix the user already deleted.

Land it Debouncing is an efficiency measure; cancellation is a correctness one, and only the second fixes out-of-order results.

Q63. "Implement a modal dialog properly in either framework."

Reveal answer

Strong answer The framework part is trivial; the correctness is entirely in the behaviours, and there are seven.

Render outside the normal tree — a portal in React, the CDK overlay in Angular — so an ancestor's overflow: hidden or stacking context cannot clip it.

Trap focus inside while open, so Tab cycles within the dialog rather than reaching the page behind.

Move focus in on open, to the dialog or its first control, and restore it to the trigger on close — otherwise a keyboard user is returned to the top of the document.

Close on Escape, and on a backdrop click if the content is not destructive.

Mark the background inert so screen readers do not read the page behind it.

Lock body scroll without causing a layout jump from the disappearing scrollbar.

Announce it with role="dialog", aria-modal and a label.

Which is why I would use a primitive — the CDK, or a headless library in React — rather than writing it. The native <dialog> element now handles several of these itself and is worth considering.

Land it Every hand-rolled modal I have reviewed missed focus restoration, and it is the one that most affects a keyboard user.

Q64. "How would you implement a virtualised list in each?"

Reveal answer

Strong answer With a library in both — Angular's CDK virtual scroll, or TanStack Virtual in React — because the mechanics are subtle and the edge cases are many.

The principle is the same: render only the visible window plus a small buffer, and use a spacer sized to the full list so the scrollbar behaves normally.

The costs are the same in both and worth naming: rows need known or measurable heights; browser find-in-page only sees rendered rows; deep-linking to an item in the middle needs extra work; and screen readers see a changing set of nodes, so the accessibility wiring has to be deliberate.

Variable-height rows are the genuinely hard case, since the total height is unknown until items are measured, and the scrollbar jumps as estimates are corrected.

Which is why I would ask first whether it is needed. For a few hundred rows, making the row cheaper or paginating is less code and easier to keep correct.

Land it Virtualisation is where people start and where they should finish — it is the most complex option and frequently unnecessary once the row is cheap.

Q65. "How do you implement an error boundary in each framework?"

Reveal answer

Strong answer React has a first-class concept: an error boundary component catches errors thrown while rendering its subtree and renders a fallback instead. That containment is genuinely useful — one broken panel does not blank the page.

Angular has no direct equivalent for rendering. A replaced global ErrorHandler catches errors application-wide for reporting, but it cannot substitute a fallback for one subtree.

The Angular approach is defensive rather than structural: handle errors where they occur — a resource's error signal rendering an error state, a try-catch around risky work — so nothing escapes to the point where containment would be needed.

In practice both end up in a similar place for data errors, because a failed fetch is handled by the component either way. The difference shows for unexpected render-time errors, where React can contain the damage and Angular cannot.

Both need a global handler regardless, for reporting with route and release context.

Land it This is one of the few places React has a structural capability Angular lacks, and it is worth saying so rather than claiming an equivalent exists.

Q66. "Implement theme switching in both."

Reveal answer

Strong answer The framework part is almost nothing, because the mechanism should be CSS custom properties rather than framework state.

An attribute on the root element — data-theme="dark" — selects a block of token overrides. Everything else in the application reads tokens and needs no knowledge of the theme.

The framework holds only the current choice: a signal in a service in Angular, a store or context in React, persisting to local storage and defaulting to the system preference.

The part that matters is applying it before first paint. If JavaScript sets the attribute after the app boots, a dark-theme user sees a white flash on every load. The fix is a small synchronous inline script in the document head, which is one of the very few cases where a blocking inline script is correct. With server rendering, a cookie lets the server render the right theme and there is no flash at all.

Land it If the theme is implemented in JavaScript rather than in tokens, every component ends up knowing about themes and dark mode becomes a rewrite.

Q67. "How do you test a component in each framework?"

Reveal answer

Strong answer The philosophy is identical and the API differs.

React: Testing Library with Vitest or Jest. Render the component, query by role and accessible name, interact with user events, assert on what is visible.

Angular: TestBed with Vitest since v21. Create a fixture, call detectChanges(), query the DOM, assert.

The shared principle is what to assert on: rendered text, element counts, whether a control is disabled — what the user perceives. Not private fields or internal method calls, because those tests fail on every refactor without catching a defect.

The one Angular-specific gotcha is fixture.detectChanges(): there is no render loop in a test, so a state change updates the value and nothing repaints until you ask. A mysteriously failing Angular component test is usually a missing one of those.

React Testing Library's query priority — by role first, then label, then text — is worth adopting in Angular tests too, because a test that finds a button by its accessible name also verifies it has one.

Land it Querying by accessible role and name makes the test double as an accessibility check, which is free coverage.

Q68. "How does each framework handle animation?"

Reveal answer

Strong answer Both have moved toward CSS, and for the same reason: modern CSS covers most of what libraries were used for, at no bundle cost.

Angular has an animations package with a domain-specific language, now positioned as the option for coordinated sequences and reliable enter and leave hooks. The router also supports view transitions for page-level morphs.

React has no built-in animation; the ecosystem answer is a library such as Framer Motion, or plain CSS transitions and the View Transitions API.

The genuine remaining gap in both is animating an element out. CSS alone cannot, because the element is removed before it can animate; something has to delay the removal. That is what the frameworks' or libraries' presence mechanisms provide.

Regardless of choice, two rules: animate only transform and opacity, which the compositor handles without forcing layout; and respect prefers-reduced-motion, which is not optional.

Land it Pulling in an animation library for one fade is a poor trade, and knowing that is usually what the question is testing.

Q69 · Scenario. "You must add a React widget to an Angular application. How?"

Reveal answer

Strong answer First I would push back and ask why, because the answer changes the approach and often removes the need.

If it is a genuinely one-off third-party widget, the mechanics are straightforward: an Angular component that owns a container element, mounts the React root in afterNextRender, passes props on input changes, and unmounts in the destroy hook.

The care needed is in three places. Cleanup — an unmounted React root that is not disposed is a leak. Change detection — the React tree is outside Angular's model entirely, and communication back must go through a callback that writes an Angular signal. And bundle cost — you now ship two frameworks, which is a significant and permanent addition.

The alternative I would propose is wrapping the React widget as a custom element, so the Angular side sees a standard HTML element with attributes and events. That is cleaner and it is how most cross-framework widget distribution works.

If the real reason is that a team prefers React, the answer is an organisational conversation rather than a technical one.

Land it Shipping two frameworks is a permanent cost on every page load, so it should be justified by a specific irreplaceable widget rather than a preference.

Q70. "What are Web Components and where do they fit?"

Reveal answer

Strong answer A browser standard for defining custom elements with encapsulated markup and styles, usable from any framework or none.

They fit where framework independence is the requirement: a design system consumed by teams using different frameworks, a widget embedded in customers' sites, or a long-lived component set expected to outlive the current framework choice.

Both frameworks support them well. Angular can compile components to custom elements, and React 19 improved custom element support, particularly around passing non-string properties and handling custom events.

The costs are real. Passing objects and functions across the boundary is awkward, since attributes are strings and property setting is a different mechanism. Server-side rendering support is limited. Shadow DOM isolates from global styles, which is either the point or a problem depending on your design system. And form participation, though improved, needs deliberate work.

So my position is: excellent for a cross-framework design system or an embeddable widget, and unnecessary overhead inside a single-framework application.

Land it The question they are usually really asking is whether you would adopt them by default — and the answer is no, only when framework independence is an actual requirement.

Q71. "Compare TypeScript's role in each framework."

Reveal answer

Strong answer Angular assumes it. Decorators carry configuration the compiler reads, templates are type-checked against component classes under strictTemplates, and the tooling is built around it. You cannot sensibly write Angular without it.

React supports it and the ecosystem has largely adopted it, but it is optional and JavaScript React remains common.

The meaningful difference is template type checking. In Angular, binding a wrong type to an input or renaming a property fails the build across every template that used it. In React, JSX is type-checked as ordinary TypeScript, so props are checked — which is comparable — but only if the project is typed throughout.

The other difference is that Angular's version is tied to a supported TypeScript range, so upgrading one usually means upgrading the other; React is looser.

In both, the highest-value typing is at the boundary: validating API responses at runtime, since a generic on a fetch is a claim rather than a check in either framework.

Land it The shared trap is trusting a type assertion on a network response — in both frameworks that is a promise you are making, not one the compiler verifies.

Q72. "How do you handle authentication in a frontend, in either framework?"

Reveal answer

Strong answer The design is framework-independent and only the spelling differs.

Access token in memory, not localStorage, so an injected script cannot read it and it dies with the tab.

Refresh token in an HttpOnly, Secure, SameSite cookie, which JavaScript cannot read at all.

A request interceptor — Angular's functional interceptor, or a fetch wrapper in React — attaching the token and, on a 401, performing a single shared refresh with the other pending requests subscribing to it, then retrying.

Route guards for user experience, ideally the kind that prevents the chunk from being downloaded at all.

Server-side authorisation on every endpoint, which is the only part that actually enforces anything.

The refresh stampede is the detail interviewers press on: ten parallel 401s must produce one refresh, not ten, or token rotation logs the user out at random.

Land it The frontend's job is to make the right thing convenient; the backend's job is to make the wrong thing impossible — and only one of those is security.

Q73. "How do you do internationalisation in each?"

Reveal answer

Strong answer Angular has built-in i18n producing one build per locale, so each user downloads only their language and there is no runtime translation cost. The trade is that switching language means loading a different build, usually at a different URL — good for search engines, awkward for an in-app switcher. Runtime libraries such as Transloco exist for that case.

React uses libraries — react-intl or i18next — which are runtime by default, so one build serves all locales and switching is instant, at the cost of shipping translations to the client.

The choice is really about how often a single user changes language, and everything else follows.

The parts people underestimate are identical in both: pluralisation rules differ by language and cannot be done with string concatenation; dates, numbers and currency must use locale-aware formatting; text expands by around thirty percent in some languages so layouts must not assume English width; and right-to-left needs logical CSS properties rather than left and right.

Land it Build-time versus runtime is the one real architectural difference; everything else is the same set of linguistic problems.

Q74. "How do you handle a very large form in each framework?"

Reveal answer

Strong answer The shared principle is to avoid doing work on every keystroke, and each framework has its own version of the mistake.

React: a naive controlled form re-renders the entire form on every character, because the value lives in the parent's state. The standard fix is uncontrolled inputs with a library like React Hook Form, which reads values from the DOM at submit time and re-renders only what needs it.

Angular: the equivalent mistake is subscribing to the whole group's valueChanges and doing work in the handler. The fixes are subscribing to individual controls, debouncing, or setting updateOn: 'blur' so validation runs once per field visit rather than per character.

Shared to both: split the form into section components so there are re-render or change-detection boundaries; avoid expensive validators, particularly regular expressions with catastrophic backtracking; and do not compute anything across all sixty fields in the render path.

And for very large forms, consider whether it should be several steps, which is a product improvement as well as a performance one.

Land it updateOn: 'blur' and uncontrolled inputs are the same idea in two dialects: stop reacting to every character.

Q75. "What is your approach to component documentation in either ecosystem?"

Reveal answer

Strong answer A running gallery rather than prose, because prose about components goes stale and nobody notices.

Storybook works with both and is the common answer: each component gets stories for its states — default, loading, error, empty, disabled, long content, and the awkward edge cases.

Two benefits beyond documentation make it worth the effort. It is a development environment for building a component in isolation, without navigating an application to reach it. And it is a visual regression testing surface, since stories can be screenshotted and compared per commit.

It also enforces the presentational discipline: a component that cannot be rendered in a gallery is one that fetches or injects, which is exactly the design smell from earlier in this drill.

What I would document in prose is the small amount that a gallery cannot show: when to use this component rather than that one, and the decisions behind the API.

Land it A gallery that requires components to be renderable in isolation enforces good boundaries as a side effect, which is worth more than the documentation.

Drill · Judgment across the two ecosystems

The last fifteen of this block are opinion questions with defensible answers. What is graded is whether your position holds up when pushed.

Q76. "Is the virtual DOM a performance feature?"

Reveal answer

Strong answer No, and it never really was — it is a programming model feature that happens to be fast enough.

Its purpose is to let you describe the UI as a function of state and let the library work out the DOM operations, rather than writing imperative updates. Diffing two trees is strictly more work than knowing exactly what changed.

Angular's model demonstrates that: fixed binding slots with a direct comparison is less work than building and diffing a tree, which is why fine-grained reactive frameworks generally benchmark well.

What the virtual DOM buys is uniformity — any component can be re-rendered from scratch and the library reconciles it — and that is genuinely valuable for how code composes.

The honest summary is that both models are far faster than any real application needs, and application-level decisions dominate: what you download, how many nodes you render, and how much work is in the render path.

Land it Claiming the virtual DOM is a performance feature is a common interview answer and a wrong one; saying it is a programming model with acceptable cost is the accurate version.

Q77. "Both ecosystems moved toward fine-grained reactivity. Why?"

Reveal answer

Strong answer Because both older models did more work than necessary and the cost was most visible on the devices most people actually use.

Angular's Zone.js could only know that something asynchronous had happened, so it re-checked the whole component tree. React re-runs a component function and everything in it whenever its state changes, so an unrelated field in the same component costs a full re-render.

Signals and the compiler are answers to the same question from different directions: track precisely what depends on what, so a change updates only what it affects.

The second driver is server rendering. Both ecosystems want to send less JavaScript, and fine-grained reactivity makes it easier to reason about which parts of a page genuinely need to be interactive at all.

The convergence is worth noting in an interview because it undercuts most tribal arguments: the two frameworks now disagree about syntax and packaging far more than about how rendering should work.

Land it Both arrived at the same conclusion from opposite starting points, which is usually a sign the conclusion is right rather than fashionable.

Q78. "What is the biggest mistake teams make with React?"

Reveal answer

Strong answer Treating server data as client state — putting fetched data into Redux or context and then maintaining it by hand.

It is the same mistake as in Angular and it is more common in React, because for years there was no built-in answer and a global store was the default advice.

The result is the cache-invalidation spiral: refetch on navigation, refetch on focus, a timer, and a growing file of invalidation rules that is a caching library nobody designed.

The second-biggest is using effects for derivation — an effect that reads state and sets other state, when a computed value would do. It runs later, it can loop, and it hides the relationship.

Third is context as a store: a context whose value is an object rebuilt each render, so every consumer re-renders on every parent render, which people then try to fix with memoisation rather than with selectors.

Land it The three biggest React mistakes are all about what a piece of data actually is, rather than about React.

Q79. "What is the biggest mistake teams make with Angular?"

Reveal answer

Strong answer Not keeping up. Angular ships two majors a year with reliable migration schematics, and a codebase three versions behind is a project while one behind is an afternoon. Teams that treat upgrades as something to propose rather than schedule end up unable to adopt anything.

Second is using RxJS for state. A BehaviorSubject in a service was the standard pattern for years, and it is now a signal — but plenty of codebases keep the observable version and pay for subscriptions, cleanup and the interop.

Third is provider scope by accident. A providers array added to a component while debugging, which then renders in a loop and produces twenty instances of a service that was meant to be shared.

Fourth, and cultural, is over-architecture: NgRx adopted by default, facades in front of everything, and layers nobody would be able to justify — because the framework's structure invites more structure.

Land it Angular's failure mode is too much ceremony and falling behind; React's is too little structure and reinventing per project.

Q80. "How do you keep a frontend codebase current across framework versions?"

Reveal answer

Strong answer By making it routine maintenance on a schedule rather than a project someone proposes.

In Angular that means one major at a time with ng update, which runs the official migrations — skipping versions runs them out of order and is where upgrades go wrong. Dependencies are checked for support before starting, since an unmaintained library is the usual blocker.

In React it means keeping the meta-framework and the library set current, which is more work because there is no single migration tool and the ecosystem moves independently.

Shared practices: run the optional migrations deliberately, since each removes legacy the next one would otherwise carry; treat deprecation warnings as the next version's breaking changes; and have a test suite good enough that the upgrade is verifiable.

The organisational half matters more than the technical: a standing allocation for maintenance, so it does not compete with features and lose every time.

Land it One version behind is an afternoon and three behind is a project — which is the entire argument for putting it on a calendar.

Q81 · Scenario. "A team wants to migrate a large Angular app to React. How do you respond?"

Reveal answer

Strong answer By asking what problem they expect it to solve, because the answer is usually not one a framework change fixes.

If it is "the code is a mess" — that is architecture, and it will be a mess in React too, because the same people will make the same decisions with different syntax.

If it is "we cannot hire Angular developers" — that is a real reason, and it is a business case with a number attached.

If it is "React is more modern" — that is not accurate as of 2026, and I would show the convergence: signals, zoneless, resources, incremental hydration.

If it is a genuine capability gap, such as needing Server Components for a content-heavy public site, that is a legitimate technical reason and worth taking seriously.

Then the cost: a rewrite of a large application is quarters of work producing what already exists, during which no features ship and the old system still needs maintaining. The strangler pattern — new features in the new stack behind a shared shell — is more realistic, and it means running two frameworks for a long time, which is its own cost.

Land it Most framework migrations are architecture problems wearing a framework costume, and the same architecture in a new framework produces the same problems in eighteen months.

Q82. "Which framework has better tooling, and does it matter?"

Reveal answer

Strong answer They are strong in different places.

Angular's CLI is the most complete first-party tooling in the ecosystem: project generation, code generation, build, test, and migration schematics that upgrade code rather than only versions. There is one way to do things and it works.

React's tooling is ecosystem-provided and moves faster — build tools have improved dramatically, and the meta-frameworks provide comparable scaffolding. The devtools profiler telling you why a component rendered is genuinely excellent and has no exact Angular equivalent.

Whether it matters depends on team size. For one team, tooling choice is a week of setup. For twenty teams, first-party tooling with migrations is worth a great deal, because it standardises without negotiation and makes upgrades tractable.

The thing I would call out as underrated is Angular's migration schematics. Being able to run a command that rewrites every template to the new control flow syntax is a capability the React ecosystem generally does not offer.

Land it The tooling difference matters in proportion to how many teams have to agree, which is why it barely registers for a startup and dominates for an enterprise.

Q83. "How do you evaluate whether to adopt a new frontend library?"

Reveal answer

Strong answer Six checks, and I would apply them in this order because the early ones are cheap.

What does it cost? Bundle size, and whether it tree-shakes. A 200 KB library for one feature is a decision, not a detail.

Is it maintained? Recent releases, responsive issues, more than one maintainer. A popular but abandoned library is a future migration.

Can we replace it? How deeply would it embed into the codebase, and what would removing it cost. A library behind a thin interface is a reversible decision.

Does it do too much? A library that solves one problem well is safer than a framework-within-a-framework.

Is it accessible? For anything rendering interactive UI, this is a first-order question and it is frequently not addressed.

Could we write it? If it is a hundred lines, writing it is often better than a dependency with a lifetime.

Land it The reversibility question is the one people skip: a library you can remove in a day is a small decision, and one that touches every component is a marriage.

Q84. "What frontend skills transfer between frameworks, and what does not?"

Reveal answer

Strong answer Almost everything that matters transfers, which is the useful thing to notice.

Transfers completely: the browser — DOM, CSS, layout, the event loop, network behaviour. Architecture — the four kinds of state, component boundaries, rendering strategy. Performance — the three budgets, Core Web Vitals, bundle analysis. Accessibility. Design craft — space, type, colour, states. And debugging method.

Does not transfer: the syntax, the specific reactivity semantics, the ecosystem's conventions and library set, and the framework's own failure modes.

The proportion is roughly eighty to twenty in favour of transferable, which is why a strong engineer from one framework becomes productive in the other within weeks.

The corollary worth stating: someone who only knows a framework, and not the browser underneath it, does not transfer well and also struggles when the framework does not have an answer.

Land it Invest in the browser and in architecture; the framework layer is the part that will be replaced, twice, over a career.

Q85 · Scenario. "Your Angular app must embed inside a customer's page that uses another framework. How?"

Reveal answer

Strong answer The requirement is isolation in both directions — their styles must not affect us and ours must not affect them — plus a small, stable interface.

The options in order of isolation.

An iframe gives complete isolation of styles, scripts and globals, and is the safest. The costs are communication through postMessage, awkward sizing, and no shared visual context — a dropdown cannot overflow the frame.

A custom element with shadow DOM, compiling the Angular app to a web component. Styles are isolated, the customer sees a normal HTML element with attributes and events, and it sits in their layout properly. This is usually the right answer.

Direct embedding — mounting into a div on their page — is the most integrated and the least safe: global styles collide in both directions, and two frameworks may fight over the same globals.

Whichever, I would keep the interface small and versioned: a few attributes in, a few custom events out, and no assumption about their framework at all.

Land it An iframe when isolation matters more than integration; a custom element when it must feel part of their page — and be explicit about which you chose and why.

Q86. "How would you introduce signals or the compiler to a team resistant to change?"

Reveal answer

Strong answer By demonstrating rather than proposing, and by picking something where the benefit is felt rather than described.

I would convert one real feature — ideally one with a known bug class, such as a screen with stale-data complaints or a page with a re-render problem — and show the before and after with a number attached.

Then a written note of the conventions, so the second person does not have to re-derive them, and pairing for the first few conversions rather than documentation.

The policy I would propose is the one that works for every framework change: new code in the new style, existing code left alone, converted when touched. That avoids both a migration project and an indefinitely mixed codebase.

And I would take resistance seriously rather than as an obstacle. Often it is based on a real prior experience — a migration that consumed a quarter and delivered nothing — and the answer is a smaller, reversible first step rather than a better argument.

Land it "New code in the new thing, old code converted when touched" is the migration policy that finishes, because it never competes with feature work.

Q87. "What would make you say a frontend codebase is well engineered?"

Reveal answer

Strong answer Six observable properties, none of which is about the framework.

State ownership is obvious. For any value on screen, I can find the one place that writes it in under a minute.

Boundaries are enforced. Deleting a feature means deleting a folder, and the lint rules say so rather than a document.

The four states are everywhere. Every data surface handles loading, error, empty and populated, and the error state is distinguishable from empty.

Tests fail for behaviour, not structure. A refactor does not turn the suite red.

Performance is defended. Bundle budgets in the build, real user metrics with alerts.

Accessibility is built in, in the design system rather than retrofitted per screen.

What I would not use as a signal: the framework, the age of the code, or the presence of a particular state library.

Land it All six are checkable in an hour with the repository open, which is why they make a better answer than adjectives.

Q88. "What is your view on CSS approaches — modules, utility classes, CSS-in-JS?"

Reveal answer

Strong answer They solve the same problem — scoping — and the differences are ergonomic more than technical.

CSS modules or Angular's view encapsulation: locally scoped class names, no runtime, and ordinary CSS. The default I would reach for.

Utility classes such as Tailwind: styling in the markup, effectively no unused CSS, and consistency enforced by a constrained set of values. The costs are verbose markup and a learning curve; the benefit is that the design system constraints are unavoidable.

Runtime CSS-in-JS has fallen out of favour, because generating styles at runtime costs performance and interacts badly with server rendering and streaming. Zero-runtime alternatives that extract at build time get most of the benefit without that.

Whichever, the important part is the same: tokens as CSS custom properties underneath, so theming works across any of these approaches and across component boundaries that selectors cannot cross.

Land it The scoping mechanism is a preference; the token layer underneath is the part that actually decides whether theming and consistency are possible.

Q89. "How do you decide between a component library and building your own?"

Reveal answer

Strong answer By how strong the design requirements are, and by whether the team can own accessibility.

Use a full library — Material, or a React equivalent — when the product does not need a distinctive look. Internal tools, admin panels, anything where shipping quickly and being accessible matters more than being unique. You inherit keyboard behaviour, focus management and ARIA that would take a year.

Use headless primitives — the Angular CDK, or a headless React library — when you have your own design language. This is the sweet spot: you own every pixel and inherit the behaviour that is hard to get right.

Build from scratch only with both a strong design language and the capacity to own accessibility properly. Most teams that choose this underestimate the second part and ship something a keyboard user cannot operate.

The failure I would warn against explicitly is taking a full library and fighting its styles — that produces something that breaks on every upgrade and is harder to maintain than either alternative.

Land it Headless primitives plus your own styling is the option people most often miss, and it is usually right for a team with designers.

Q90 · Design. "You are choosing the frontend stack for a five-year product. Walk me through it."

Reveal answer

The real test Whether you weight longevity and hiring over current preference.

Strong answer Over five years the framework will change under me at least twice, so I would optimise for what survives that.

I would ask first: who will maintain this in year three, what can we hire for here, what shape is the product — public or authenticated, forms-heavy or unusual, how many teams — and what must never break.

Then the choices. Framework by hiring and product shape, not preference. TypeScript strictly, because five years of refactoring without types is a different proposition entirely. Rendering strategy per route rather than one for the whole app. Boring, well-maintained dependencies with a preference for the platform where possible, since every dependency is a five-year commitment.

Boundaries enforced in tooling from day one, because retrofitting them at year two is a project.

An upgrade budget in the plan, so keeping current does not compete with features.

What I would deliberately avoid: anything with one maintainer, anything requiring a bespoke build setup, a custom abstraction over the framework, and micro-frontends before there are teams to justify them.

Land it Over five years, the decisions that pay are TypeScript, enforced boundaries, boring dependencies and a maintenance budget — none of which is the framework choice everyone argues about.

Likely follow-ups
"How would you keep the option to change framework later?"

By keeping the framework at the edges. Business logic in plain TypeScript with no framework imports, API clients and domain models framework-free, and design tokens as CSS rather than in a framework's styling system.

Then a migration is rewriting the view layer against logic that still works, rather than rewriting everything. That is worth doing anyway, because the same separation is what makes the logic testable today.

What I would not do is build an abstraction layer over the framework to make it swappable. That produces a worse framework nobody else knows, and the swap never happens.

14 · DrillPerformance & Accessibility Scenarios — Q91–Q125

These thirty-five are scenarios rather than definitions. Each one is a symptom, and what is graded is the order in which you rule things out.

The habit being tested throughout is measuring before changing, and knowing which tool answers which question. "I would profile it" is a weak answer; naming the panel and what it would tell you is a strong one.

Drill · Diagnosing slowness

Twenty scenarios. Answer each in diagnosis order, and say what each observation would rule out.

Q91. "A page is slow. What is your first question?"

Reveal answer

The real test Whether you separate the three budgets before touching anything.

Strong answer Which kind of slow, because the three have different causes and different fixes.

Slow to arrive — blank for seconds on first visit, fine afterwards. That is the download budget: bundle size, request count, missing compression, no caching.

Slow to become usable — content appears but clicks do nothing. That is startup: too much bootstrap work, an app initialiser, hydration of the whole page.

Slow while using it — typing lags, scrolling stutters. That is the interaction budget: render-path work, list rendering, too many nodes.

I would decide which from real user metrics if they exist, or by recording a load and an interaction in the browser's performance panel on a throttled profile against a production build.

Only then would I open the framework's own profiler, because that answers "which component" and is useless if the real problem is a 2 MB image or a missing compression header.

Land it The commonest mistake is optimising component rendering when the page ships 1.8 MB of JavaScript on a mobile connection.

Q92 · Scenario. "Bundle halved from 800 KB to 400 KB. LCP did not move. Why?"

Reveal answer

Strong answer Because JavaScript was not the binding constraint, and there are three usual reasons.

The LCP element is an image. If the largest visible element is a hero image, its size, format and priority decide the metric. Preloading that one image usually moves it more than the entire bundle reduction did.

Something else blocks the critical path — a render-blocking stylesheet, a synchronous third-party script in the head, or a font that blocks text rendering.

The server is the bottleneck. If time-to-first-byte is 900 milliseconds, the browser has not begun downloading anything, and no client-side change touches that.

I would find out which by looking at the waterfall and at what the browser identifies as the LCP element, both of which the performance panel reports directly.

The lesson is the one from Q91: identify the budget being spent before optimising. Bundle size is the most visible number and frequently not the constraint.

Land it The browser tells you which element is the LCP element — reading that first saves a week of optimising the wrong thing.

Q93 · Scenario. "Typing in a filter box above a 500-row table lags. Diagnose."

Reveal answer

Strong answer Five checks, cheapest first, and the first two usually resolve it.

List identity. Missing or unstable track or key means every keystroke destroys and rebuilds 500 rows. Free to fix and often the entire problem.

Filtering in the render path. A method called from a template, or an unmemoised filter in a React render, running the whole filter on every render rather than once per data change.

Row cost. 500 rows times however many bindings and nested components each has. The profiler attributes time per component and answers this directly.

Debouncing. If each keystroke triggers a request or an expensive recomputation, 200 milliseconds removes most of the work with no perceptible delay.

Whether 500 rows are needed at all — pagination or virtualisation bounds the DOM regardless of the data size.

I would fix identity and the render-path work first, re-measure, and only then consider virtualisation, which is a real change I would rather justify with a profile.

Land it Two of the five are minutes of work and usually the whole problem, which is why the order matters more than the list.

Q94 · Scenario. "The page scores well in the lab and users say it is slow. What is going on?"

Reveal answer

Strong answer The lab is measuring something different from what users experience, and there are four usual gaps.

Hardware and network. Laboratory runs are typically on fast machines and connections. Real user monitoring segmented by device and connection usually shows a completely different distribution.

Averages hiding a tail. A good mean with a bad 95th percentile means a meaningful minority has a bad time, and they are the ones who complain.

The wrong page measured. Lab tests usually cover the landing page; users spend their time on the dashboard after logging in, which is never measured because it needs authentication.

Feedback rather than speed. An action taking 400 milliseconds with no visible response feels slower than one taking 800 with an immediate state change. Metrics do not capture that at all.

The last is the most common, and the fix is an immediate optimistic state change rather than making anything faster.

Land it Perceived performance is a real engineering property — immediate feedback and stable layout often beat making anything actually faster.

Q95. "What causes layout shift and how do you eliminate it?"

Reveal answer

Strong answer Anything that changes the size or position of already-rendered content, and there are five recurring causes.

Images without dimensions. The browser cannot reserve space, so everything below jumps when the image loads. Always set width and height, or an aspect ratio.

Web fonts swapping. The fallback and the custom font have different metrics, so text reflows. Fixed with preloading, subsetting and metric-matched fallbacks via size-adjust.

Content injected above existing content — a banner, a cookie notice, an error message appearing at the top. Reserve the space, or insert it where it pushes nothing.

Skeletons the wrong size. A loading placeholder smaller than the content it replaces produces a jump at exactly the moment the user starts reading.

Deferred content without reserved space, which is the same problem introduced by an optimisation.

The measurement is the layout shift metric in the performance panel, which highlights the shifting elements directly.

Land it Layout shift is the metric engineers cause most and measure least, because it does not appear on a fast connection where everything arrives at once.

Q96 · Scenario. "A dashboard fires fourteen requests on load and takes four seconds. What do you do?"

Reveal answer

Strong answer Look at the waterfall first, because "fourteen requests" and "four seconds" have several possible relationships.

If they ran sequentially, something is dependent — chained fetches, or an operator that queues rather than parallelises — and fixing the sequencing is the whole win.

If they ran in parallel, check whether the browser's per-host connection limit queued them, and whether the server is slow per request.

Then the structural fixes, in order of value. Do not fetch what is not visible — panels below the fold go behind a viewport trigger, removing their requests from the initial load entirely. Reduce round trips for what is visible, possibly with an aggregate endpoint. Render progressively, so the page is useful at one second rather than four.

What I would avoid is one mega-endpoint returning everything: it becomes the slowest panel's latency for every panel and fails as a unit.

Land it Progressive rendering usually beats raw speed here — fourteen panels appearing over three seconds feels far better than a blank page for four.

Q97 · Scenario. "Memory grows the longer the app is open, and it eventually crashes. Find it."

Reveal answer

Strong answer Something is holding destroyed components alive, and the method is a heap snapshot comparison rather than inspection.

Take a snapshot, perform the suspect cycle ten times — usually navigating into and out of a screen — force garbage collection, take a second snapshot and compare. A component class whose instance count grew by ten names the culprit, and the retainer path shows what is holding it.

The four usual holders: a subscription to something that never completes — router events, intervals, event streams, WebSockets; a listener added with addEventListener and never removed; a third-party widget never destroyed; and a long-lived store holding a reference or accumulating an array that only grows.

The fixes are the framework's cleanup mechanisms — takeUntilDestroyed or a destroy hook in Angular, an effect cleanup in React — plus calling the third party's own destroy method.

To catch it earlier I would add the navigate-ten-times check to a periodic performance test, since leaks are otherwise found by users after six hours.

Land it The retainer path is the step people skip in favour of guessing, and it is what turns a suspicion into a line number.

Q98. "How do you make images fast?"

Reveal answer

Strong answer On a content-heavy page the image strategy is worth more than any JavaScript optimisation, and it is five things.

Correct size for the device. Serving a 2000-pixel-wide image to a 400-pixel-wide phone wastes most of the bytes. srcset and sizes, or a framework image component that generates them.

Modern formats — AVIF or WebP with a fallback — which are typically half the size for the same quality.

Dimensions always, so space is reserved and nothing shifts.

Lazy-load below the fold, and explicitly not the LCP image, which should be prioritised and preloaded.

A CDN with transformation, so sizes and formats are generated on demand rather than maintained by hand.

Both frameworks provide an image component that enforces most of this, and using it is strictly better than a bare <img>.

Land it Marking exactly one image as priority — the LCP element — and lazy-loading everything else is usually the single largest win on a content page.

Q99. "How do you handle third-party scripts?"

Reveal answer

Strong answer By measuring them separately first, because their share of main-thread time is usually invisible to the people who add them.

Then in order: remove what nobody uses — there is always a tag from a campaign that ended two years ago. Load the rest late and asynchronously, never blocking rendering. Load on interaction where possible — a chat widget loaded when the chat button is clicked rather than on every page view is often several hundred kilobytes saved for a feature one percent use. Move what can move server-side, such as analytics via a server-side tag manager.

And a policy: every third party has an owner, a purpose and a review date, or the list only grows.

The governance point matters more than the technique. Engineers optimise their own bundle by kilobytes while a marketing tag adds hundreds, and the only durable fix is making that visible in the same dashboard.

Land it Third-party scripts are usually the largest performance problem on a commercial page and the one engineers have least authority over, so the answer is as much political as technical.

Q100 · Scenario. "Users on slow connections say the app is unusable. Internally everything is fine."

Reveal answer

Strong answer The first problem is that the team cannot see it, so I would make it visible before proposing fixes.

That means real user metrics segmented by connection and device, so the difference between the office and the field is a number rather than a claim. And it means throttled testing as part of normal work, because a fast laptop hides everything.

Then the likely causes in order: total download size, since 1.5 MB is many seconds on a slow connection; the number of round trips, because latency dominates over bandwidth on mobile; images not sized for small screens; and no useful content until JavaScript has run.

The fixes follow: aggressive route splitting and deferring, an image strategy, prerendering or server rendering so something meaningful arrives in the first response, and fewer requests for a first useful screen.

And a product conversation worth raising: a lighter path for constrained clients, even offering less, beats a rich experience nobody can load.

Land it The durable fix is making the slow case measurable and visible in CI, or every subsequent feature reintroduces the problem.

Q101. "How do you prevent performance regressions?"

Reveal answer

Strong answer By making regressions fail something, because anything that only appears on a dashboard gets ignored.

Bundle budgets in the build, set just above current size, so a dependency that adds 300 KB fails CI rather than being discovered a month later. This is the single highest-value control, because bundle growth is invisible in code review.

A Web Vitals run on key pages in CI, tracked as a trend with generous thresholds rather than a hard gate, since it is noisy.

Real user monitoring with alerts, segmented by device and connection.

A dependency review step, so adding a package is a decision with a size attached rather than a line in a lockfile.

And culturally, throttled testing as normal practice, so the slow case is something the team experiences rather than reads about.

Land it Performance work not defended by automation is undone within two quarters, which is why the budget in the build outranks any single optimisation.

Q102 · Scenario. "A drag interaction stutters. What do you look at?"

Reveal answer

Strong answer Pointer events fire far faster than the screen refreshes, so the first question is whether the framework is being driven at pointer rate.

If every mousemove sets state, that is a render per event — dozens per second — and the fix is to keep the per-frame work out of the framework: update the element's transform directly inside a requestAnimationFrame loop, and set state only at meaningful boundaries such as the drop.

The second question is what is being animated. Changing left, top, width or margin forces layout on every frame. transform and opacity are handled by the compositor and do not.

The third is layout thrashing: reading a measured value such as getBoundingClientRect and then writing a style, repeatedly, forcing recalculation between each pair. Batch the reads, then the writes.

The performance panel distinguishes these directly, because it shows whether the time is scripting, layout or paint — and those have completely different fixes.

Land it Pointer-rate events must never be the framework's rate; convert them to frame rate before they touch state.

Q103. "What is the cost of a component, and when does 'too many' become the problem?"

Reveal answer

Strong answer Each instance costs some framework bookkeeping, its bindings or hooks, and its DOM nodes. The unit that matters is bindings and nodes, not components.

A hundred components with three bindings each is cheaper to update than ten with a hundred.

It becomes the problem in the thousands of DOM nodes, and the symptom is usually creation time and memory rather than update time — 500 rows of 20 elements is 10,000 nodes, and the browser's own layout cost dominates whatever the framework does.

The fixes in order: render less, via pagination or virtualisation; make each row simpler, so it is a handful of elements rather than a nested component tree; and only then look at the framework's update behaviour.

Worth adding: splitting a large component into smaller ones is usually good for performance in both frameworks, because it creates skip or memo boundaries, and it is better for readability regardless.

Land it When a list is slow, the browser's layout and paint is often a bigger share than the framework's work, and the performance panel says which in thirty seconds.

Q104 · Scenario. "A modal takes 300 ms to close on an older laptop. Diagnose."

Reveal answer

Strong answer The asymmetry is the clue: opening adds a component and closing removes one, and removal is the expensive direction when there is teardown work.

Candidates in order: destroying many children, each running cleanup — a modal containing a large table destroys every row; subscriptions and observers being torn down; a third-party widget's destroy method doing real work; and an exit animation whose duration simply has to elapse.

I would record the close in the performance panel first, because it answers whether the time is scripting or simply waiting — and if it is waiting for a transition, no amount of code optimisation helps.

If it is teardown of many children, the fix is usually not to render them all in the first place: virtualisation or pagination inside the modal reduces both open and close cost.

And a design point: if the close is unavoidably slow, start the visual dismissal immediately and let the teardown happen behind it, so the user does not wait for cleanup they cannot see.

Land it Distinguishing waiting from working is the whole diagnosis here, because a transition duration and a slow teardown look identical to the user and have opposite fixes.

Q105. "What would you measure to know a frontend is fast enough?"

Reveal answer

Strong answer Real user metrics, at the 95th percentile, segmented by device and connection — not laboratory scores and not averages.

The three Core Web Vitals cover the general case: Largest Contentful Paint for arrival, Interaction to Next Paint for responsiveness, Cumulative Layout Shift for stability.

Beyond those, I would add product-specific timings for the actions that matter here — how long from clicking a row to seeing the detail, how long from submit to confirmation — because those are what users describe when they say it is slow.

And funnel completion, because a page that renders fast and where nobody finishes the task is not succeeding at anything.

"Fast enough" is then defined against those numbers with a stated target, so it is a threshold rather than an opinion — and the target should come from what the product needs, not from a benchmark.

Land it Segmenting by device is the step that changes conversations, because it converts "it is fine" into "it is fine for half our users".

Drill · Accessibility in practice

Twenty questions on the half of accessibility that automation cannot catch — which is the half that decides whether the product is usable.

Q106. "Where would you start on an application with no accessibility work at all?"

Reveal answer

Strong answer With a keyboard, on the main journey, before running any tool. Ten minutes of tabbing through sign-in and the primary task finds more than an hour of reading reports.

What that finds, in the order it usually appears: elements that cannot be reached at all because they are divs with click handlers; no visible focus indicator; a focus order that jumps around because the DOM order differs from the visual layout; dialogs that cannot be escaped; and forms whose errors cannot be found.

Then an automated audit for the mechanical issues — contrast, missing labels, invalid ARIA — which is a third of the problems and free on every commit.

Then I would fix in order of blast radius: the design system first, because fixing the button and input components fixes every screen at once; then the shared layout for landmarks and heading structure; then individual screens.

What I would not do is start with a compliance checklist and work down it. That optimises for a report rather than for whether the product can be used.

Land it Fixing the design system first means each subsequent fix is one component rather than forty screens.

Q107. "Why is outline: none such a problem, and what is the correct approach?"

Reveal answer

Strong answer Because it removes the only indication a keyboard user has of where they are. Without it, tabbing is navigating a page blindfolded — the application is not usable at all.

It gets written because the default focus ring also appears on mouse clicks, which looks untidy, so people remove it globally and never replace it.

:focus-visible solves exactly that problem: the browser applies it for keyboard navigation and not for a mouse press. So the correct approach is to style :focus-visible with a clearly visible indicator and leave the behaviour to the browser.

The indicator itself needs care: at least 3:1 contrast against both the element and its surroundings, and an outline-offset so it is not lost against a similarly-coloured border. A ring that is technically present but invisible on your brand colour is the same bug with extra steps.

There has been no good reason to remove focus outlines since :focus-visible shipped, which makes it one of the few things I would treat as a hard rule in review.

Land it It is the single most damaging line in frontend CSS, and it is written for an aesthetic reason that a one-word change solves.

Q108 · Scenario. "A single-page app is silent to screen readers on navigation. Fix it."

Reveal answer

Strong answer This is the defining accessibility bug of single-page applications: a full page load announces the new page automatically, and a client-side route change announces nothing at all.

The user activates a link and, as far as their screen reader is concerned, nothing happened.

Two fixes, and I would do both. Move focus to the new page's main heading or its main landmark after navigation, which both announces the new context and puts the user at the top of the new content rather than wherever they were.

Announce it in a live region — a visually hidden element updated with the new page title — for cases where moving focus is disruptive.

Alongside that, update the document title on every route, since it is what a screen reader reads for the window and what appears in browser history.

I would verify with an actual screen reader rather than assuming, because this specific behaviour is one automated tools do not report at all.

Land it Every route-based framework has this problem by default, and none of them fix it for you — it is the first thing I check in an unfamiliar single-page application.

Q109. "How do you make a custom dropdown accessible?"

Reveal answer

Strong answer First I would ask whether it must be custom, because a native <select> brings keyboard behaviour, mobile pickers and screen reader support for free, and a great many custom dropdowns exist only for styling.

If it must be custom, the requirements are specific: it opens with Enter, Space or the down arrow; arrow keys move through options; typing jumps to a matching option; Home and End go to first and last; Escape closes and returns focus to the trigger; Tab closes and moves on.

The ARIA is a combobox pattern: the trigger has role="combobox", aria-expanded, and aria-controls pointing at the listbox; options have role="option" and aria-selected; and the active option is tracked with aria-activedescendant so focus stays on the input while the highlight moves.

Which is why I would use a headless primitive rather than writing it — the CDK's list key manager and overlay in Angular, or a headless component library in React. Hand-rolled dropdowns get about half of this right.

Land it The number of behaviours here is the argument: a custom dropdown is roughly twelve requirements, and every hand-rolled one I have reviewed missed at least three.

Q110. "What does 'semantic HTML' actually buy you?"

Reveal answer

Strong answer Behaviour and meaning that you would otherwise have to build, and would build worse.

A <button> is focusable, activates on Enter and Space, announces its role, participates in forms, and shows a focus ring. A <div role="button" tabindex="0"> needs a keydown handler for both keys, a focus style, and the role — four things, one of which is always forgotten.

Beyond controls, semantics give navigation. Screen reader users jump between landmarks — main, nav, header — and between headings, the way sighted users skim. A page built entirely of divs offers neither, so the only way through it is linearly from the top.

It also gives resilience: native elements work when CSS fails to load, when JavaScript errors, and in reader modes and translation tools.

And it is less code, which is the argument that persuades people who are not persuaded by the rest.

Land it The first rule of ARIA is that no ARIA beats bad ARIA — a wrong role actively misleads, which is worse than no role at all.

Q111. "How should form errors be presented?"

Reveal answer

Strong answer Next to the field, connected programmatically, announced when they appear, and shown at a moment that is not hostile.

Placement: immediately after the field, not in a banner at the top, so the user does not have to map a message back to a control.

Connection: aria-describedby pointing at the message and aria-invalid on the control, so a screen reader announces the problem when focus reaches the field rather than just saying "invalid".

Announcement: role="alert" on the message so it is read when it appears, and on a failed submit, focus moved to the first invalid field.

Timing: on blur, not on every keystroke. A required field is invalid before the user has typed anything, and showing that immediately tells them off for not having started.

Content: what to do, not what is wrong. "Enter a valid email, for example name at example dot com" beats "Invalid input".

And errors must not be signalled by colour alone — an icon and text as well.

Land it Every one of these also helps users with no impairment, which is the general pattern: accessible forms are simply better forms.

Q112. "How do you handle focus when content changes dynamically?"

Reveal answer

Strong answer With a rule per situation, because getting it wrong loses the user's place entirely.

A dialog opens: move focus into it, trap it there, and restore it to the trigger on close. Without restoration, the user is returned to the top of the document.

Content is removed while focused — a row deleted, a section collapsed — focus falls to the document body, which is the worst outcome. Move it deliberately to a sensible neighbour: the next row, or the control that performed the deletion.

New content is inserted: usually do not move focus, which would be disruptive. Announce it in a live region instead.

A route changes: move focus to the new page's heading, as in Q108.

An asynchronous result arrives: announce it; move focus only if the user is waiting for it and would act on it immediately.

The general principle is that focus should follow the user's intent — moved when they caused a context change, left alone when the system did.

Land it Removing the focused element without moving focus is the most common of these, and it is invisible unless you test with a keyboard.

Q113. "What are live regions and when do you use one?"

Reveal answer

Strong answer A live region is an element whose content changes are announced by a screen reader without moving focus. You mark it with aria-live, or use a role that implies it such as role="status" or role="alert".

polite waits for a pause; assertive interrupts. Assertive is for genuine urgency — a session about to expire, an error that blocks what the user is doing — and overusing it makes the application hostile.

The cases that need one: a search returning "23 results", an item added to a cart, a save confirmation, a validation summary, and a background operation completing.

Two implementation details decide whether it works. The region must exist in the DOM before the content changes — creating the element and its content together is often not announced. And the content must actually change, so repeating the same message twice may be silent unless you vary it or clear it first.

Both frameworks' CDKs provide an announcer utility that handles these details, which is worth using rather than hand-rolling.

Land it A toast notification with no live region is invisible to a screen reader user, which means they get no confirmation that anything happened.

Q114 · Scenario. "An automated audit reports zero issues. Is the app accessible?"

Reveal answer

Strong answer No, and the number worth quoting is that automated tools catch roughly a third of real issues.

What they catch well is mechanical: contrast ratios, missing alternative text, missing labels, invalid ARIA, duplicate ids.

What they cannot catch is everything about meaning and sequence. Whether the alternative text is useful rather than merely present — "image" passes and helps nobody. Whether the focus order makes sense. Whether a custom control's keyboard behaviour is complete. Whether headings describe the content. Whether an announcement is comprehensible. Whether the task can actually be completed.

So a clean audit means the mechanical layer is fine, which is a real achievement and not a conclusion.

The remaining coverage is a keyboard pass on every new screen, and a screen reader pass on the critical journeys periodically.

Land it Automated tools are a gate against regressions, not evidence of accessibility — and treating a clean report as done is how products get sued.

Q115. "How do you make a complex data table accessible?"

Reveal answer

Strong answer Starting from real table markup, because the semantics do most of the work and nothing else reproduces them.

<table> with <thead>, <th scope="col" on headers, and <th scope="row" where a row has a heading cell. That lets a screen reader announce "Price, row 4, £12.99" instead of just "12.99", which is the difference between a usable table and a list of numbers.

A <caption> describing what the table contains.

For sorting, the header contains a real button and the <th> carries aria-sort with the current direction, so the state is announced rather than only shown by an arrow.

For selection, real checkboxes with labels naming the row, not a click handler on the row.

For row actions, buttons with accessible names that identify the row — "Delete invoice 4021", not "Delete" repeated forty times.

And if it is virtualised, be deliberate: the row count must be conveyed, since a screen reader otherwise reports only what is rendered.

Land it Forty buttons all announced as "Delete" is the failure that makes a table unusable, and it is invisible when you can see which row you are on.

Q116. "How do you write good alternative text?"

Reveal answer

Strong answer By asking what the image is for in this context, because the same image needs different text in different places.

Decorative — a background flourish, an icon beside a text label that says the same thing. Empty alt="", so the screen reader skips it. An icon with a visible label announced twice is noise.

Informative — a product photo, a diagram. Describe what matters: "Blue running shoe, side view", not "image" and not the filename.

Functional — an image inside a link or button. The text describes the action, not the picture: a magnifying glass button is "Search", not "magnifying glass icon".

Complex — a chart or a data graphic. Short alternative text plus a longer description or the underlying data in a table, because a meaningful chart cannot be summarised in a sentence.

Two rules: do not start with "image of", since the screen reader already says it is an image; and do not use the filename, which is the most common automatic failure.

Land it The same photograph is decorative on one page and informative on another, which is why alternative text cannot be generated once and reused.

Q117. "How do you support keyboard users on a complex interactive page?"

Reveal answer

Strong answer Five things, and the first two are most of it.

Everything interactive is reachable, which follows from using native elements rather than from adding tabindex everywhere.

The order matches the visual layout, which means the DOM order should match the visual order. CSS that reorders visually — order in flexbox, grid placement — creates a mismatch where focus jumps around the screen.

A skip link as the first focusable element, so a user does not tab through forty navigation items to reach the content on every page.

Composite widgets take one tab stop, with arrow keys inside. A toolbar or a tab list where every item is a tab stop is exhausting; the roving-tabindex pattern is what makes it bearable.

No keyboard traps. Anything focus enters, focus must be able to leave — the classic failure being an embedded widget that captures Tab.

And tabindex greater than zero is essentially always wrong, because it creates a separate ordering that overrides the document and is impossible to maintain.

Land it Tabbing through the page yourself finds nearly all of this in two minutes, which is why it belongs in the definition of done rather than in an audit.

Q118. "How would you build accessibility into a team's process?"

Reveal answer

Strong answer By moving it earlier, since retrofitting is where the expense is.

In design, because contrast and touch-target sizes are decided before any code exists, and fixing them afterwards means changing the design.

In the design system, so the components everyone uses are already correct — focus, keyboard, ARIA, contrast. That covers most of the surface without every engineer becoming an expert.

In CI, with template lint rules and an automated audit — a gate against regressions rather than proof of correctness.

In the definition of done, as a keyboard pass on every new screen.

Periodically with a screen reader on the critical journeys, which is a scheduled activity rather than a per-pull-request one.

And one cultural thing: framing it as usability rather than compliance. Every argument here also improves the experience for people with no impairment, and that framing gets more done than a legal one.

Land it Fixing the design system once fixes every screen, which is why it outranks per-screen remediation by a large margin.

Q119. "What accessibility issues are specific to single-page applications?"

Reveal answer

Strong answer Four, and all of them stem from the browser no longer doing something it used to do on a page load.

Route changes are silent. No announcement, and focus stays wherever it was. Fixed by moving focus to the new heading and updating the document title.

Focus is lost on re-render. Removing or replacing the focused element sends focus to the body. This is the list-identity problem again: a bad key or track destroys and recreates the focused input.

Dynamic content is unannounced. Content arriving after load — search results, toasts, validation — needs live regions, because there is no page load to trigger an announcement.

Loading states are invisible. A spinner is a visual convention; without aria-busy or a live region, a screen reader user does not know anything is happening.

None of these is caused by a framework, and none of them is fixed by one either — every route-based framework has all four by default.

Land it Each of the four is the browser doing something for free on a full page load, which the application must now do explicitly.

Q120 · Design. "Design the accessibility strategy for a product used by government employees."

Reveal answer

Strong answer That audience makes conformance a contractual requirement rather than a preference, so I would start by establishing the exact standard and level required, since it varies by jurisdiction and by contract.

Then a strategy in four parts.

Build it in, at the design system layer, so components are correct once and every screen inherits it. This is by far the cheapest place to spend.

Constrain the technology. No custom controls where a native one exists; headless primitives with proven keyboard behaviour where a native one does not; no interaction that requires a mouse or a drag without a keyboard alternative.

Verify at three levels — automated in CI, keyboard in the definition of done, and a scheduled audit with assistive technology, ideally including testing with actual users of it.

Document it. A conformance statement, an audit trail, and a route for reporting issues, because that is usually part of what is being bought.

The thing I would insist on early is design involvement, because contrast, target sizes and reliance on colour are decided in the design and are the most expensive things to change afterwards.

Land it Testing with real assistive technology users is what separates a product that passes an audit from one that people can actually use.

Likely follow-ups
"How do you handle a third-party component that is not accessible?"

It becomes a procurement question rather than an engineering one. I would raise it with the vendor with specific findings, since a named failure is actionable and "it is not accessible" is not.

In the meantime, either wrap it to add what is missing where that is possible, or replace it. What I would not do is ship it and note the exception, because in this context that is the thing being contracted against.

Going forward, accessibility becomes an evaluation criterion for any new dependency that renders interactive UI — which is a policy worth having regardless of the audience.

Drill · Where performance and accessibility meet

The last five of this block sit on the boundary, where an optimisation and an obligation pull against each other.

Q121 · Scenario. "Virtualising a list improved performance and broke find-in-page. What now?"

Reveal answer

Strong answer That is an inherent consequence, not a bug in the implementation: only rendered rows exist, so the browser's find cannot see the rest, and neither can a screen reader browsing the list.

Three responses depending on the product.

Provide search in the application that queries the full dataset, and make it prominent enough that users reach for it rather than the browser's. This is usually the right answer, and it is better than find-in-page anyway because it can search the server's copy.

Convey the full size so assistive technology reports it — the row count in the container, so a user is told there are 4,000 rows rather than the 30 rendered.

Reconsider virtualisation if the list is only a few hundred rows, where making rows cheaper or paginating gets most of the performance benefit with none of the cost.

What I would not do is ship it without acknowledging the trade, because a user who cannot find a row concludes the data is missing.

Land it Virtualisation trades browser-native capabilities for speed, so it obliges you to replace the capabilities you removed.

Q122. "Does lazy loading hurt accessibility or SEO?"

Reveal answer

Strong answer It can, and the distinction is whether the content exists in the markup or only after JavaScript runs.

Lazy-loading images is safe: the element exists with its alternative text and dimensions, only the bytes are deferred.

Lazy-loading content is where the risk is. If a section only exists after a viewport trigger, a crawler that does not scroll may never see it, and a screen reader user navigating by headings will not find it either.

Two mitigations. Server-render the content and defer only the interactivity — incremental hydration in Angular, Server Components in React — so the markup is present and indexable while the JavaScript is not shipped or executed.

Trigger on interaction as well as viewport for anything reachable another way, so a keyboard user activating a control gets the content even without scrolling.

Infinite scroll is the worst case for both: content that only exists after scrolling, plus a footer that becomes unreachable.

Land it Deferring bytes is safe; deferring the existence of content is the thing that costs you crawlers and keyboard users.

Q123. "A designer wants a very light grey for secondary text. How do you handle that conversation?"

Reveal answer

Strong answer By agreeing with the intent and disagreeing with the value, and bringing a number rather than an opinion.

The intent — secondary text should recede — is correct. The value fails 4.5:1, which means a meaningful share of users cannot read it: anyone on a laptop outdoors, anyone over about fifty, anyone with reduced contrast sensitivity, and anyone on a cheap screen.

What I would bring to the conversation is the measured ratio and the darkest grey that still passes, so the discussion is about which of two acceptable values rather than about whether the rule applies.

And the reframing that usually settles it: muted does not mean low contrast. Recession can come from size, weight and spacing as well as colour, so the hierarchy can be preserved without the text becoming unreadable.

If they still want it, that is a decision for whoever owns the product's obligations — but it should be made explicitly rather than by nobody checking.

Land it Bringing the passing value rather than the objection turns a disagreement into a choice, which is how these conversations actually get resolved.

Q124. "How do animations and accessibility interact?"

Reveal answer

Strong answer In three ways, and the first is a genuine health issue rather than a preference.

Motion can cause harm. Some people experience nausea, dizziness and migraine from interface motion, particularly large movements, parallax and spinning. The operating system's reduced-motion setting is how they tell us, and prefers-reduced-motion is how we hear it. It is not optional.

The right implementation reduces rather than removes — near-zero durations keep transitions functionally intact, including code that waits for a transition to end. For the specific triggers — large parallax, spinning loaders, anything moving much of the screen — substituting a fade is better than a near-instant version of the same movement.

Animation can hide state changes. A long transition means the screen reader announces something before it is visible, or the user acts before it arrives.

Auto-playing motion is a barrier — carousels that advance on a timer are hard for people who read slowly, and they need a pause control.

Land it Reduced motion is the rare accessibility setting where ignoring it can make someone physically unwell, which is why it belongs in the base stylesheet rather than in a checklist.

Q125 · Design. "Design a performance and accessibility budget a team would actually keep."

Reveal answer

Strong answer The design goal is that it fails automatically and is achievable today, because a budget that is permanently red is a budget that gets ignored.

Set thresholds just above current numbers, not at an aspirational target. The job is catching regressions, and you can ratchet them down as improvements land.

Fail the build on hard limits — initial bundle size, and the automated accessibility rules — because those are deterministic and not noisy.

Warn on the noisy ones — Web Vitals from a CI run — and track them as a trend, since a hard gate on a noisy metric trains people to rerun until it passes.

Alert on real user metrics rather than only laboratory numbers, segmented by device, because that is the population that matters.

Give each budget an owner, so a breach has someone to go to rather than being everyone's problem.

And review quarterly: ratchet down what has improved, and honestly relax anything that has been breached and waived three times, because a rule nobody enforces is worse than no rule.

Land it A budget set aspirationally is ignored within a month; one set at today's number and ratcheted is still working two years later.

15 · DrillVisual Design Judgment — Q126–Q150

These twenty-five are the questions from the hook at the start of this chapter — the ones where candidates who can design a system for ten million items say "the second one just looks cleaner" and stop.

What is being graded is vocabulary: whether you can name why something works, which is what makes the judgment repeatable and teachable rather than a matter of taste.

Answer each one as if a designer were in the room, because in most teams one is.

Drill · Space and structure

Spacing decides more of an interface's quality than any other single factor, and it is the most learnable.

Q126. "Two cards use the same components and one looks better. What is usually the difference?"

Reveal answer

The real test Whether you can name a mechanism rather than a preference.

Strong answer Almost always spacing, and specifically two things about it.

Arbitrary values versus one scale. The worse card has padding like 13, 17 and 22 pixels, each chosen in the moment. Nothing lines up, and the eye is extremely good at detecting near-misses — a 13px gap beside a 14px gap reads as a mistake even to someone who cannot measure it.

Uniform gaps versus grouped ones. The worse card uses the same gap everywhere, so the eye gets no information about what belongs with what. The better one has tight spacing inside groups and larger spacing between them.

Beyond spacing, the other usual suspects are alignment — elements sharing edges rather than each starting at a slightly different position — and a type hierarchy that uses weight and colour rather than only size.

What it is almost never is colour or a border, which is why adding those rarely fixes a card that feels wrong.

Land it "One spacing scale, and larger gaps between groups than within them" explains most of the difference in most pairs you will be shown.

Q127. "Why does a spacing scale use 4, 8, 12, 16, 24, 32, 48 rather than every multiple of four?"

Reveal answer

Strong answer Because adjacent steps have to be obviously different, and a linear scale fails that at the top end.

At small sizes, four pixels is a visible proportion — 4 and 8 are clearly different. At larger sizes it is not: 28 and 32 are indistinguishable in use, so the choice between them becomes arbitrary again and you are back to picking numbers by feel.

Steps that grow roughly geometrically keep each one a meaningful proportion of the last, so the scale stays decidable all the way up.

The practical benefit is that spacing stops being a decision. You are choosing between "the default" and "one step bigger", not between 16 and 18 — which is faster to write, faster to review, and produces consistency without anyone enforcing it.

The same reasoning gives type scales their ratio, for exactly the same reason.

Land it A scale with too many steps is the same problem as no scale, because the choice becomes arbitrary again.

Q128. "A form feels confusing though every field is labelled correctly. What is likely wrong?"

Reveal answer

Strong answer The spacing gives no grouping information, so the eye cannot tell which label owns which input.

If a label sits 16 pixels above its input and 16 pixels below the previous field, both readings are equally available. The user resolves it, but at a small cost per field, and across twelve fields that reads as the form being hard.

The fix is the proximity rule: the gap between groups must be larger than the gap within a group. Six pixels from label to input, twenty-four between fields — a ratio around 1:3 — and the ambiguity disappears without any border or box.

Two other candidates worth checking. A single column that is too wide, so the eye travels a long way from label to input. And too many fields visible at once with no sectioning, where fieldset groups with headings reduce the perceived length.

What I would not reach for is adding borders around each field group, which is compensating for a spacing problem and looks busy.

Land it Proximity is information, not decoration — this is the single rule that fixes most forms that feel wrong for no nameable reason.

Q129. "When is a border the right answer, and when is it a symptom?"

Reveal answer

Strong answer A border is right when it marks a genuine boundary the user needs to perceive — the edge of an editable field, the separation between two independent regions, the container of a distinct object.

It is a symptom when it is compensating for spacing that does not communicate the grouping. If the proximity already says these things belong together, the border adds nothing but visual weight; if it does not, the border is patching it and the result looks busy and boxy.

The diagnostic I use is to remove it. If the grouping is still obvious, the border was decoration. If it collapses, the spacing needs fixing and the border is hiding that.

Where a boundary genuinely is needed and a full border is too heavy, the lighter options are a background tint, a single dividing line, or a shadow — in roughly that order of subtlety.

The interfaces that feel calm generally use very few borders and a lot of space; the ones that feel cluttered are usually a grid of boxes inside boxes.

Land it Try deleting the border first — if nothing gets worse, it was never doing a job.

Q130. "How much whitespace is right?"

Reveal answer

Strong answer It depends on who uses it and how often, and getting that wrong makes an otherwise good design feel wrong for its audience.

Generous suits consumer products, marketing pages and anything used occasionally. It is calmer, easier to scan, and reads as confident.

Dense suits professional tools used all day — a trading screen, a support console, an admin table. Someone who looks at the same screen for eight hours wants more information per screen and less scrolling, and generous whitespace becomes an obstacle between them and their work.

The specific mistake is applying consumer spacing to a professional tool because it looks better in a screenshot. The people who use it daily will resent it, and they are right.

The good answer is a density token — one variable scaling the whole spacing scale — so the same components serve both cases, and users of data-heavy screens can choose. Several mature products ship exactly this.

Land it Whitespace is not a quality signal, it is a fit-for-audience decision, and screenshots systematically bias it toward the wrong answer for tools.

Q131. "What makes a page scannable?"

Reveal answer

Strong answer Structure that survives being looked at fast, which is how people actually read screens — they skim first and read only what they have decided to.

Four things do most of it.

A visible hierarchy of at most three levels, so the eye can find the entry points. Achieved with weight and space as much as size.

Grouping through proximity, so related things read as a unit without needing to be enclosed.

Alignment, so there is a consistent line the eye can follow down the page rather than a ragged edge.

Short blocks. A wall of text is not scannable at any font size; the same content as three paragraphs with a heading is.

The test is literal: scroll the page quickly and look only at what stands out. If that skim does not recover the main points, the page is not scannable no matter how well written it is.

Land it Bolding words inside a paragraph does not make it scannable — structure creates scannability, and emphasis only marks it.

Q132. "How do you choose a line length, and why does it matter?"

Reveal answer

Strong answer Around 45 to 75 characters, with 65 as a target, and the reason is mechanical rather than aesthetic.

At the end of each line the eye has to travel back and find the start of the next one. Too long and it loses its place, re-reads a line, and tires. Too short and the constant return breaks the rhythm.

The implementation is max-width: 65ch, where ch is the width of a zero in the current font — so it scales with the font, where a pixel width breaks the moment the size changes.

This is the most common reason a full-width text block on a wide monitor is unpleasant: 160-character lines, and the reader gives up two paragraphs in without knowing why.

It interacts with line height too — longer lines need more vertical separation to track, so a wide measure and a tight line height compound each other.

Land it One max-width in ch is the highest-value single line of CSS on any page with prose on it.

Q133. "A heading looks cramped. What is likely wrong?"

Reveal answer

Strong answer Two candidates, and they are opposite mistakes.

Line height inherited from body text. A 36-pixel heading at 1.5 has 18 pixels between lines, which for large text looks like two separate things rather than one heading. Large text needs proportionally less line height — around 1.1 to 1.25 — because it already has visual separation.

Not enough space around it. A heading needs more space above than below, because the space above separates it from the previous section and the space below binds it to the content it introduces. Equal space on both sides makes it float ambiguously between the two.

A third, less common: default letter-spacing at a large size. Type designed for body text often looks loose when scaled up, and a slight negative tracking on large headings tightens it.

The general relationship worth remembering is that as text gets bigger, line height and letter spacing both want to get proportionally smaller.

Land it More space above than below is the rule people never hear and immediately recognise once they do.

Q134. "How do you build hierarchy without making everything bigger?"

Reveal answer

Strong answer By using the other four tools, because size is the bluntest and the one that runs out fastest.

Weight. Semibold body text often reads as more important than larger regular text, at a fraction of the space.

Colour. Muting secondary text is frequently the entire answer — the primary text becomes prominent by contrast, without anything growing.

Space. A heading with generous space above reads as starting a section regardless of its size.

Case and letter-spacing. Small uppercase with added tracking reads as a label. Used sparingly, because uppercase is measurably slower to read.

Combining two or three is far more effective than pushing one hard, and it keeps the page calm.

The related constraint is that three levels per screen is usually the limit. More and the levels stop being distinguishable, which is the same failure as a spacing scale with steps too close together.

Land it A page where everything is large has no hierarchy at all, because hierarchy is relative and there is nothing left to be small.

Q135. "Why do professional interfaces use fewer colours than beginners expect?"

Reveal answer

Strong answer Because colour carries meaning, and meaning is destroyed by having too much of it.

If six things on a screen are coloured, the accent that was supposed to say "this is the action" is competing with five others, and it says nothing. Colour is a limited resource and spending it on decoration means it is unavailable when you need it to direct attention.

A working palette is smaller than people expect: five to eight neutrals doing ninety percent of the work, one accent with a hover and a tint, and four semantic colours for state. About eighteen values for an entire product.

The second reason is that neutrals are what make content readable. A page whose structure is carried by greys and space, with colour used once, is calmer and easier to scan than one where structure is carried by colour.

The third is practical: fewer colours means fewer contrast pairs to verify, and a palette that survives a dark theme.

Land it A page where the accent appears once is far more effective at directing attention than one where six things are blue.

Q136. "Why is naming a token --color-blue-500 a mistake?"

Reveal answer

Strong answer Because it names the appearance rather than the role, and the appearance is the part that changes.

The moment a dark theme is added, or the brand shifts from blue to green, every reference to blue-500 becomes a lie. You then either rename two hundred references or live with a codebase where blue-500 is grey, which is worse.

A token named --color-accent or --color-danger stays true whatever value it holds, so a theme is a block of overrides and nothing else in the codebase changes.

The same reasoning applies to space — --space-4 survives a change to the base unit, --space-16px does not — and to component tokens, where --card-padding is better than --card-padding-large.

The nuance worth adding: a two-layer system is common and good. A primitive layer may legitimately be named by appearance — --blue-500 — and a semantic layer maps roles onto it. Application code only ever uses the semantic layer.

Land it Name by role in everything application code touches, and confine appearance names to the primitive layer nobody references directly.

Q137 · Scenario. "A design uses light grey text on white. It passes design review and fails your check. What do you say?"

Reveal answer

Strong answer That the intent is right and the value is not, and I would bring the measured ratio and a passing alternative rather than an objection.

Light grey on white is typically around 2.5:1 against a requirement of 4.5:1, which means it is unreadable for a substantial group: anyone on a laptop outdoors, anyone over about fifty, anyone with reduced contrast sensitivity, and anyone on a low-quality screen.

It passes design review because it is being judged on a calibrated monitor in a controlled room, which is the least representative viewing condition there is.

The reframing that usually resolves it: muted does not mean low contrast. Secondary text can recede through size, weight and spacing as well as colour, so the hierarchy is preserved with a darker grey.

And I would offer the darkest grey that still reads as clearly secondary, so the conversation is about choosing between two acceptable values rather than about whether the rule applies.

Land it Arriving with the passing value rather than the failing verdict is what turns this from a disagreement into a two-minute decision.

Q138. "What is wrong with implementing dark mode by inverting the light theme?"

Reveal answer

Strong answer Four things, each producing a specific and recognisable discomfort.

Pure black is the wrong background. White text on pure black produces halation — the letters appear to glow and vibrate, particularly for people with astigmatism. A very dark grey with near-white text is materially more comfortable.

Saturated colours become harsher. A blue that reads as calm on white can look aggressive on dark, so accents generally need to be slightly lighter and less saturated.

Elevation reverses. In light, a raised surface casts a shadow. In dark, shadows are nearly invisible, so raised surfaces must be lighter than the background — which means a dark theme needs several surface tokens rather than one.

Contrast must be re-verified. A pair that passes on light frequently fails on dark, and nothing tells you unless you check.

An inversion gets all four wrong at once, which is why inverted dark modes are recognisable as such.

Land it The elevation reversal is the one people miss, and it is why an inverted theme's cards look flat and indistinguishable from the page.

Drill · Interaction, states and taste

The last twelve of the visual block, covering the states nobody designs and the judgment calls that come up weekly.

Q139. "How many states does a button have, and why does it matter?"

Reveal answer

Strong answer At least seven: default, hover, focus, active, loading, disabled and error-adjacent.

It matters because design tools show a component at rest, so the six that are not the default get implemented by whoever writes the CSS, by accident, at the end of a task.

The consequences of skipping each are specific. No hover and the element does not feel interactive. No visible focus and the application is unusable by keyboard. No active state and a slow action feels like a dead click. No loading state and the button is clicked twice. A disabled state with poor contrast and no explanation, and the user cannot find out why they are blocked.

The one I would defend hardest in review is focus, because outline: none with nothing replacing it makes the whole product unusable for keyboard users, and :focus-visible removes every reason to write it.

Land it The difference between a professional interface and an amateur one is usually that someone designed all seven rather than one.

Q140. "How do you signal that something is clickable?"

Reveal answer

Strong answer With a visual property present at rest, not only on hover — because hover does not exist on touch and does not help someone deciding where to point.

The available signals are a boundary or background, a distinct colour, an underline for links, a shadow suggesting elevation, and conventional placement.

Flat design removed a lot of this in exchange for cleanliness, and the cost was real: users cannot tell what is interactive, so they click on nothing and miss things that are.

Two rules keep it honest. Interactive must be visually distinct from static, which is a stronger requirement than being distinguishable once you hover. And similar appearance must mean similar behaviour — if two things look alike and only one is clickable, users click both and learn to distrust the interface.

The third is size: touch targets need to be at least 44 by 44 pixels of hit area, which padding can provide without changing the visible size.

Land it If a user has to hover to find out what is clickable, the affordance has failed for every touch user before they even try.

Q141. "How long should an animation be?"

Reveal answer

Strong answer Short, and scaled to how far something moves and how often the user does it.

Roughly: 100 to 150 milliseconds for a colour change on hover; 150 to 250 for a small element entering; 250 to 350 for a panel or drawer; 300 to 400 for a full page transition.

Over about 400 milliseconds feels slow, and a user performing the action fifty times a day will come to resent it. The governing rule is that animation should never be the reason a user waits.

Easing matters as much as duration. ease-out — fast start, gentle stop — for things entering, because the movement begins immediately and feels responsive. ease-in for an entrance feels sluggish for exactly the opposite reason.

And the same animation that delights on first use is an obstacle on the fiftieth, which is why tools should be quicker than marketing pages.

Land it Design durations for the fiftieth use rather than the first, and animate only transform and opacity so the browser can do it without layout.

Q142. "What makes a loading state good?"

Reveal answer

Strong answer Four properties, and the first two are what separate a smooth interface from a twitchy one.

Delayed appearance. An indicator that appears for an 80-millisecond request is a flicker. Show it after roughly 150 milliseconds, so fast responses never show one at all.

A minimum duration once shown, a few hundred milliseconds, or a fast response produces the same flash at the other end.

Located where the change will happen. A local indicator next to the thing that is loading tells the user what is happening; a global spinner blocks the whole page for one panel's request.

Shaped like the content. A skeleton matching the eventual layout reduces perceived wait and prevents layout shift; a skeleton of a different size converts a speed win into a jump.

And a fifth for lists: keep the previous content visible with a subtle progress indication rather than clearing to skeletons, so a filter change does not flash the table empty on every keystroke.

Land it The delay-plus-minimum pair is the whole trick, and it is exactly what Angular's @loading (after …; minimum …) options encode.

Q143. "How do you design an empty state?"

Reveal answer

Strong answer By first noticing there are three of them, needing different content.

First use — nothing exists yet. This is an onboarding moment, and usually the first screen a new user sees: explain what goes here, and offer the action that creates the first one.

Filtered to nothing — data exists but none matches. Say so explicitly and offer a way to clear the filter, because the user's model is "there should be results here" and an unexplained blank suggests the data is gone.

Failed to load — say it failed, offer a retry, and make it visually distinct from the other two.

That last distinction is the most common production defect in frontend work: a failed request rendered as "you have no orders". The user concludes their data has been lost and files a support ticket.

It costs one extra branch in the template, and both frameworks' data primitives give you a distinct error signal to branch on.

Land it Empty is the state users see first and the one that gets designed last, which is exactly backwards.

Q144. "Where should a form's primary action go, and what should it say?"

Reveal answer

Strong answer At the end of the flow the user is reading, visually dominant, and labelled with the action rather than a generic word.

Placement: after the fields, since that is where the eye arrives. For a left-aligned form, aligned with the field column rather than floated right, so the eye does not have to travel.

Prominence: exactly one primary action per screen. If two things look equally important, the user has to decide which is intended, which is a decision you have handed them for nothing.

Label: the verb and its object — "Create account", "Send invitation", "Save changes" — because a scanning user reads the button before the heading, and "Submit" tells them nothing about what will happen.

The secondary action should be visually quieter — a text button rather than an outlined one — and a destructive action should not sit adjacent to the primary one, because that is where mis-clicks come from.

And it must be a real <button type="submit"> inside the form, so pressing Enter in a text field submits, which keyboard users rely on.

Land it A button labelled with its verb is readable out of context, which is how both scanning users and screen reader users encounter it.

Q145. "When should you use a modal, and when should you not?"

Reveal answer

Strong answer A modal interrupts and blocks, so it is right when the interruption is the point and wrong the rest of the time.

Right for: confirming a destructive action, a short focused task the user chose to start, and something that genuinely must be resolved before continuing.

Wrong for: anything long, because a modal cannot scroll comfortably and gives no room; anything the user might need the underlying page to complete, since they cannot see it; anything on mobile that is more than a couple of fields, where a full screen is better; and anything that should be linkable, because a modal usually has no URL.

The alternatives are usually better than people assume: a side panel keeps context visible, an inline expansion avoids the interruption entirely, and a separate route is right for anything substantial — it is linkable, the back button works, and there is room.

A stack of modals opening modals is the clearest sign the pattern is being used past its limits.

Land it If the content deserves a URL, it deserves a route rather than a modal — and most modals that grew large fail that test.

Q146. "How do you decide between a table, a list and cards?"

Reveal answer

Strong answer By what the user is doing with the data, not by how much of it there is.

A table when they need to compare across records on the same attributes — prices, dates, statuses. Alignment in columns is what makes comparison possible, and nothing else substitutes for it. Tabular numerals matter here, or the digits do not line up and comparison takes effort.

A list when they are scanning for one item and each record has a clear primary identifier. Denser than cards, easier to scan than a table when only one or two attributes matter.

Cards when each item is visual, or when the items are heterogeneous, or when the primary action is per item rather than comparison. Cards use far more space per item, which is a real cost.

The common mistake is cards for data that should be a table, usually because cards look better in a screenshot. Users then cannot compare, and they ask for a table.

On narrow screens a table often becomes a list of stacked records, and that is a deliberate transformation rather than a horizontally scrolling table.

Land it Comparison needs columns; scanning needs density; browsing needs images — and cards are chosen for aesthetics far more often than for any of those.

Q147. "What makes an icon useful rather than decorative?"

Reveal answer

Strong answer Being recognisable without a label, which is true of far fewer icons than people assume.

The genuinely universal set is small: search, close, menu, back, home, trash, plus a handful more. Everything else is learned convention at best and a guess at worst — the floppy disk for save persists among people who have never seen one, and most product-specific icons mean nothing on first encounter.

So the rule I apply is: icon plus label by default, icon alone only for the universal set or where space genuinely does not permit and a tooltip is available.

Where an icon is used alone it needs an accessible name, or a screen reader announces "button" with no indication of what it does — and forty such buttons in a table is unusable.

Icons earn their place in two ways: speeding recognition of something already labelled, and marking status where the shape adds a second channel alongside colour, which is exactly what colour-blind users need.

Land it An icon-only interface is a memory test; icons with labels are faster for everyone after the first use and possible for everyone on the first.

Q148 · Scenario. "A stakeholder says the design 'looks cheap'. How do you diagnose that?"

Reveal answer

Strong answer By translating an impression into specifics, because "cheap" is a reaction to a small set of recurring causes.

The list I would check, in order of how often it is the answer:

Inconsistent spacing — several arbitrary values rather than one scale. This is the most common single cause and the one people never name.

Misalignment — elements that nearly share an edge but do not.

Too many colours, or colours at full saturation, which reads as unconsidered.

Default typography — the browser's default sizes and line heights, with no scale and no measure limit.

Missing states — no hover, no focus, no transition — so nothing responds and the interface feels dead.

Low-quality assets — a stretched logo, images at the wrong resolution, inconsistent icon weights.

I would work through those with them in front of the screen, because naming two specifics converts a vague objection into a task list.

Land it "Cheap" almost always decodes to inconsistency, and consistency is the most mechanical thing on the list to fix.

Q149. "How do you give useful design feedback as an engineer?"

Reveal answer

Strong answer By naming the mechanism and the constraint, rather than expressing a preference — because a designer can act on the first and can only defend against the second.

"I do not like this" is not actionable. "The gap between the label and its input is the same as the gap between fields, so it is ambiguous which label belongs to which" is.

The feedback engineers are uniquely placed to give is about the things a static design cannot show. What happens in the states nobody drew — loading, error, empty, long content, a name that is sixty characters. What it costs — this hero image is 2 MB, this pattern needs a request per row. What breaks at the edges — narrow screens, large text settings, right-to-left.

And measurable constraints rather than opinions: a contrast ratio, a touch target size, a text length that will overflow.

What I would avoid is redesigning it in the review. The useful contribution is the constraint; the design response to it belongs to the designer.

Land it Engineers see the states and the costs that a static design cannot show, which is the feedback nobody else in the room can give.

Q150. "How would you improve your visual design judgment deliberately?"

Reveal answer

Strong answer By converting reactions into explanations, since the gap is vocabulary rather than taste.

Analyse interfaces you admire. Open the inspector and read the actual values: the spacing scale, the type sizes, the number of colours, the line height. It is usually far simpler than it looks, and seeing that is what makes it reproducible.

Practise naming the difference. When one of two versions looks better, force yourself to say why in mechanical terms before moving on. That is the specific skill this block of questions tests.

Learn the small set of rules that do most of the work — one spacing scale, proximity means grouping, a type scale, a limited palette named by role, all seven states. It is a short list and it covers most decisions.

Constrain yourself. Build something with one font, three type sizes and five colours. Constraints teach faster than freedom, because they force the other tools.

Work near designers and ask why, rather than only receiving decisions.

Land it Design judgment is learnable in a way most engineers assume it is not, because most of it is a small set of nameable rules rather than innate taste.

16 · DrillDesign a Frontend — Q151–Q175

The last twenty-five are full design questions, the kind that occupy a forty-five-minute round on their own.

There is no single right answer to any of them, and that is the point. What is graded is the shape of your response: what you clarify before designing, whether the design follows from the answers, which trade-offs you name, and what you would refuse to build.

Answer each one out loud in that order — questions, design, trade-offs, refusals — because that sequence is most of the score.

Drill · Product surfaces

Thirteen designs for specific screens and flows. Start each by saying what you would ask.

Q151 · Design. "Design a product listing page for a catalogue of ten million items."

Reveal answer

The real test Whether you move the work to the server without being told, and whether you treat the URL as state.

Strong answer I would ask three things first: is it public and does search ranking matter; how many facets are there and are they dependent; and how fresh must prices and stock be.

Assuming public and SEO-relevant, the design:

Server-render or prerender the first page. Ten million items cannot be prebuilt entirely, so server rendering with edge caching for popular queries and a short revalidation window.

All filtering, sorting and paging on the server. The browser holds one page. This is not negotiable at this size.

All of that state in the URL — facets, sort, page — so results are linkable, bookmarkable and indexable, and the back button behaves.

Cursor pagination if the catalogue changes while people browse, because offset paging duplicates and skips rows when items are inserted.

Images as the priority: correct sizes, modern formats, dimensions set, one priority image, everything else lazy. On a listing page images are most of the bytes and most of the LCP.

Keep previous results visible while the next query loads, with a subtle progress indication, rather than flashing empty on every facet click.

What I would refuse: loading the catalogue client-side and filtering in the browser, and infinite scroll as the only navigation, which makes the footer unreachable and results unlinkable.

Land it The two decisions worth defending are server-side everything and URL-as-state, and both are painful to retrofit once twenty screens exist.

Likely follow-ups
"Facet counts are slow to compute. What do you do?"

Render the results without waiting for the counts and stream them in, so the page is usable at the first paint. That is exactly what streaming with a suspense boundary is for.

If they remain slow, approximate counts with a clear indication — "about 1,200" — which is nearly always acceptable to users and much cheaper to produce.

"How would you handle the transition when a user applies a filter?"

Optimistically update the visible filter state so the interface responds immediately, keep the old results visible with reduced emphasis, and replace them when the new ones arrive.

And use a replace navigation rather than a push for rapid filter changes, or the back button walks the user through every individual toggle.

Q152 · Design. "Design a checkout flow."

Reveal answer

Strong answer Checkout is where every general principle becomes a specific requirement, because failure has a monetary cost.

Never lose the cart. Server-side so it survives a device change, with a local copy for speed.

Idempotent submission. The client generates a key per attempt so a retry or a double click cannot charge twice. This is a contract with the backend and it is non-negotiable.

The pay action ignores repeat triggers while one is in flight — exhaustMap in Angular, a disabled-and-pending state in React — rather than queueing or racing them.

No optimism about payment. The user waits for a real answer and the pending state is unambiguous.

Handle the unknown outcome explicitly. If the request times out, the client does not know whether it succeeded. The interface must say so and offer a safe way to check, rather than showing failure and inviting a second attempt.

No card data in the application — a hosted field from the provider, so the page is out of scope for card handling.

Then the ordinary care: steps as routes so back works, autosaved address details, validation before the payment step, and a clear final review.

Land it The idempotency key and the timeout-with-unknown-outcome case are what separate a checkout that has been through an incident from one that has not.

Likely follow-ups
"The user closes the tab mid-payment."

The server continues; the outcome does not depend on the browser. On return, the application looks up the order by its key and shows the real state.

That requires the pending order to be recorded before the payment call rather than after, or there is nothing to look up — a backend design point that this frontend requirement forces.

Q153 · Design. "Design a real-time collaborative document editor."

Reveal answer

Strong answer The first question decides everything: does "collaborative" mean two people rarely, or twenty people simultaneously in the same paragraph?

For coarse-grained collaboration — different people on different sections or fields — presence indicators plus section-level locking or last-write-wins with a conflict warning is enough, and is a fraction of the work. Most requests for collaborative editing are satisfied by this, and saying so saves a quarter.

For genuine concurrent text editing, I would not hand-roll it. That needs conflict-free replicated data types or operational transformation, and a mature library is the right answer; writing your own is a research project.

The frontend design is then: a service owning the connection and the document, exposing content, presence and connection state as reactive values; local edits applied immediately and sent asynchronously; and remote changes merged without disturbing the local cursor — which is the detail that makes or breaks it.

Plus throttled outgoing updates rather than one per keystroke, reconnection with resync, and honest connection state so a user knows when their edits are not being saved.

And not a plain contenteditable, which is a decade of browser inconsistencies best left to an editor library.

Land it The senior move here is scoping the requirement down before designing, because the two interpretations differ by an order of magnitude in cost.

Q154 · Design. "Design a data-heavy admin application: 30 tables, complex filters, exports."

Reveal answer

Strong answer With thirty similar screens, the decision is to build the table once and configure it thirty times.

One generic table component taking a column configuration, with templates for custom cells. Thirty hand-written tables is thirty places to fix any bug.

Server-side filtering, sorting and pagination. The browser holds one page, or it fails at the first large customer.

All table state in the URL. In an admin tool, shareable and bookmarkable views are a daily-use feature, not a nicety — "here is the filter that shows the problem" is how these teams work.

A shared filter model so filters serialise consistently across all thirty screens and can be saved as named views.

Exports server-side and asynchronous, with a notification when ready. Generating a CSV in the browser dies at a few hundred thousand rows and blocks the tab while it tries.

Dense spacing, because this is a tool people use all day, and a density token so it is adjustable.

Then the details: keep previous rows visible while loading, debounce filter input, cursor pagination if data shifts, and bulk actions that state clearly how many records they affect.

Land it The failure mode to name is the generic table growing a flag per requirement until it is a configuration language with worse tooling — cap the configuration and use templates beyond it.

Q155 · Design. "Design a multi-step onboarding wizard."

Reveal answer

Strong answer Three decisions, made explicitly.

One form, not five. A single form object with a nested group per step keeps cross-step validation possible, makes the whole payload available at any point, and means back navigation is just rendering a different section with no state transfer.

Steps as routes, not a switch. Users press the back button, and a wizard that treats it as leaving the flow is infuriating. Routes also give deep links and make the current step visible in the URL.

State scoped to the wizard's route, so every step shares one instance and it is destroyed on leaving the feature — root would leak between attempts, component-level would not survive navigation.

On top: a guard per step redirecting to the first incomplete one, so nobody deep-links into step four with empty data; an autosaved draft so a closed tab does not lose everything; a leave-confirmation guard; and a review step with links back to each section.

And a product point worth raising: every step is a place to abandon, so the fewest steps that make sense is a conversion decision as well as a design one.

Land it One form and steps-as-routes are the two choices that are painful to retrofit, so they are the ones to get right before writing anything.

Q156 · Design. "Design a notification system — in-app, real-time, with read state."

Reveal answer

Strong answer I would ask about volume and urgency first, because a system delivering three a day and one delivering three hundred are different products.

Transport: server-sent events for a one-way feed, which is simpler than WebSockets and reconnects automatically. Polling on an interval is an acceptable and much cheaper answer if near-real-time is enough.

State: a root service owning the connection and exposing the list, the unread count and connection state. The count is derived, never stored separately.

Read state on the server, because it must be consistent across devices. Marking read is optimistic locally with reconciliation.

Rendering: a badge with the count, a panel with the list, and pagination or virtualisation if the volume warrants it. Toasts only for things that are genuinely time-sensitive, because a toast for a routine event is an interruption.

Accessibility: a live region for new arrivals — polite, not assertive — because a badge changing is invisible to a screen reader user.

And two things people miss: cross-tab consistency so marking read in one tab updates the other, and grouping or rate-limiting so a burst of fifty does not overwhelm the panel.

Land it Polling is the answer people are embarrassed to give and is frequently correct — it is simpler, cacheable, and degrades gracefully under load.

Q157 · Design. "Design the frontend for a live event dashboard with 10,000 concurrent viewers."

Reveal answer

Strong answer At that concurrency it is a delivery problem far more than a rendering one, so I would start there.

Do not open ten thousand sockets if the data is shared. If everyone sees the same figures, publish snapshots to a CDN on a short interval and poll — cacheable, scales trivially, degrades gracefully. Reserve push connections for genuinely per-user data.

Coalesce updates on the client. Whatever the transport, buffer incoming data and apply at most once per animation frame, so a burst does not become a render per message.

Bound the DOM — only what is visible exists, and panels below the fold load on scroll.

Serve the shell statically from a CDN, so the initial load does not depend on an origin already handling event traffic.

Degrade deliberately. Under load the page should slow its update rate rather than fail — a dashboard updating every five seconds is far better than one that stops responding.

And load-test the real path, because the failure at ten thousand users is usually connection limits or a cache-miss stampede rather than component rendering.

Land it Choosing cacheable polling over per-user sockets where the data is shared converts a scaling problem into a CDN configuration.

Q158 · Design. "Design a search experience: instant results, filters, history."

Reveal answer

Strong answer Search is where debouncing, cancellation, caching and keyboard behaviour all meet, and each has a specific requirement.

Debounce around 250 milliseconds to reduce requests, and cancel superseded requests to fix ordering — they are separate problems and debouncing alone does not solve the second.

A minimum query length of two or three characters, since a single-character query matches everything and is expensive for nothing.

Cache by query, so backspacing to a previous term is instant.

Query and filters in the URL, so a search is shareable and survives a refresh.

Keyboard behaviour: arrow keys through suggestions, Enter to select, Escape to close, and aria-activedescendant so focus stays in the input while the highlight moves. This is the combobox pattern and it is the part most implementations get wrong.

All four states, with no-results distinguished from failed-to-search, and suggestions for a query that matched nothing.

And history stored locally with an obvious way to clear it, because search history is personal.

Land it Search is the screen where debouncing without cancellation produces the most visible bug: results for a prefix the user already deleted.

Q159 · Design. "Design a file upload feature: large files, progress, resumable."

Reveal answer

Strong answer The size threshold decides the architecture, so I would establish it first.

For modest files, a single request with upload progress — which requires the XHR transport, since fetch cannot report how much of a body has been sent.

For large files, chunked upload: split into pieces, upload with bounded concurrency, and track which chunks have succeeded so a failure resumes rather than restarting. A single failed 2 GB request means starting over, which on a poor connection means never finishing.

Around either: validate before sending — type and size client-side for fast feedback, and again server-side because the client is not trusted. Bound concurrency for multiple files, or the connection pool is exhausted and everything slows. Cancellation per file, with a visible control.

The design details that matter: per-file progress rather than one aggregate bar, a clear failed state with retry for that file alone, and never blocking the whole interface during an upload.

And do not set the content type manually for form data — the browser must, because it includes the multipart boundary.

Land it Resumability is the requirement that changes the design, and it is worth asking about explicitly rather than discovering after building the simple version.

Q160 · Design. "Design an offline-capable field-service application."

Reveal answer

Strong answer Offline changes the shape of the data layer rather than adding a feature to it, so I would design around four pieces.

Local storage as the read source. IndexedDB holds the data and the interface reads from it, so the application works identically online and offline. The network is a synchroniser, not a dependency.

An outbox for writes. Every mutation is appended to a queue with a client-generated id, applied locally immediately, and sent when connectivity allows.

A sync engine draining the outbox in order with backoff, and pulling server changes since a cursor. It must be idempotent, because a request may have succeeded before the connection dropped and will be retried.

A service worker for the application shell, so the app itself loads offline.

The hard part is the conflict policy, and it is a product decision: last-write-wins is simple and loses data; per-field merge is better where fields are independent; genuinely contended data needs the user to choose, which means the model must hold two versions.

And connectivity detection should come from request failure rather than navigator.onLine, which reports whether there is an interface, not whether your server is reachable.

Land it Making local storage the read source rather than a cache in front of the network is what makes offline a mode rather than a special case.

Q161 · Design. "Design a public marketing site plus an authenticated application, one product."

Reveal answer

Strong answer These are two different products with two different rendering strategies, and treating them as one application is the usual mistake.

The marketing site is content that is the same for everyone, so prerender it to static HTML served from a CDN. Best possible first paint, no server to run, indexable, and it cannot fall over under a launch spike. Minimal JavaScript — most marketing pages need almost none.

The application is behind a login, so client-rendered is fine: no crawler sees it, users load it once and keep the tab open, and a rendering server buys nothing.

They should be separate deployments sharing a design system library, so the marketing site does not ship the application's bundle and the application does not depend on the content build.

What is shared: tokens, primitive components, and the brand. What is not: routing, state, and the framework choice, which can legitimately differ.

The link between them is a plain navigation to the application's URL, and the session is established there.

Land it Serving a marketing page from the application's bundle is the specific failure — it ships hundreds of kilobytes for a page that needs a few, and it is the page most likely to be someone's first impression.

Q162 · Design. "Design a component library for five product teams."

Reveal answer

Strong answer The hard parts are theming, versioning and accessibility, not the components.

Layer it: design tokens as CSS custom properties at the bottom, unstyled behavioural primitives above them, styled components on top. A consumer with an unusual need drops a layer instead of forking.

Theme with custom properties, never by letting consumers write selectors into components. Variables cross encapsulation boundaries that selectors cannot, and they are a published contract rather than a reach-in that breaks on every internal change.

Build on proven primitives for overlays, focus management and keyboard navigation, rather than re-implementing them.

Ship test harnesses, so consumers' tests do not break when internal markup changes — this is the difference between a library people upgrade and one they pin.

Version it properly: semantic versioning, a changelog, deprecation warnings before removals, and codemods for breaking changes.

A stated policy for what does not belong — anything domain-aware, anything used by one team.

And a canary channel, so a team can validate an upcoming change before release.

Land it A library without harnesses and migrations gets pinned by the first team that gets burned, and a pinned library has failed regardless of its quality.

Q163 · Design. "Design the error and empty state system for a whole product."

Reveal answer

Strong answer As a system rather than a per-screen decision, because inconsistency here is what makes a product feel unfinished.

Four states on every data surface: loading, error, empty, populated — with empty and error visually distinct, because "you have no orders" and "we could not load your orders" mean opposite things.

Three kinds of empty, each with different content: first use, which is an onboarding moment; filtered to nothing, which needs a way to clear the filter; and failed, which is the error state.

Errors say what to do next, not what went wrong internally. A retry where retrying might help, a contact route where it will not, and a reference id the user can quote. Never a status code or a stack trace.

Scope the failure. One failed panel reports its own state; it does not blank the page.

Shared components for each state, plus a convention that every data-backed template has four branches — which makes it reviewable at a glance.

And a copy guideline, because the tone of an error message is part of the product and is otherwise written forty times by forty people.

Land it Rendering a failed request as an empty list is the most common production defect in frontend work, and it costs exactly one extra branch to avoid.

Drill · Organisation, process and the closing twelve

The last set are the questions asked of a lead rather than a builder. Each wants a position you can defend and a stated condition under which you would change it.

Q164 · Design. "You are the first frontend hire. What do you do in ninety days?"

Reveal answer

The real test Whether you sequence for compounding value rather than listing everything you know.

Strong answer Four phases, each making the next cheaper.

Weeks 1–2, understand. Who the users are, on what devices and connections; what the product must do in a year; what the backend looks like and whether the contracts are stable; what the team already knows.

Weeks 3–4, choose and write it down. Framework, structure, state approach, testing, CI — with the reasons, because the reasons are what let the next person change it deliberately. Chosen for the team that will exist in a year, not for me.

Weeks 5–8, build one feature properly. Not a prototype — routing, forms, data, all four states, tests, monitoring, deployed. It becomes the reference implementation and settles more arguments than any document.

Weeks 9–12, make it repeatable. A starter template, a small component set, lint rules and bundle budgets, error reporting and real user monitoring, and a short list of decisions and surprises.

Throughout, ship something visible early. Ninety days of platform work with no product to show is how a first frontend hire loses the room, however good the platform.

Land it The reference implementation is the highest-leverage artefact, because it is a convention people copy rather than a document they will not read.

Likely follow-ups
"What would you deliberately not do?"

No micro-frontends, no custom state library, no abstraction layer over the framework, and no design system before there are enough screens to know what it should contain.

All four feel like foresight and are actually guesses. They are cheap to add once the product's shape is known, and expensive to remove once everything depends on them.

Q165 · Design. "Design a frontend platform for twenty teams."

Reveal answer

Strong answer Build what is identical everywhere and expensive to get right; refuse what is product-specific.

A design system — tokens, primitives, components — with accessibility and theming solved once, plus harnesses so consumers' tests survive upgrades.

An application starter generating a project with conventions, lint rules, CI, error handling, monitoring and authentication already wired. This is the highest-leverage item, because it makes the right structure the default rather than a document.

Shared cross-cutting libraries: authentication, HTTP setup, error reporting, feature flags, analytics, internationalisation. Each is a week per team otherwise, and twenty subtly different implementations later.

Shared build and CI configuration, so budgets and gates are consistent and changeable centrally.

Upgrade support — migrations and a team that runs the framework upgrade across repositories, because twenty teams each doing it independently is the largest hidden cost of a platform.

What I would not build: domain components, opinionated state management, or an abstraction over the framework — the last being the classic platform failure, a wrapper that becomes a worse framework nobody can hire for.

Land it A platform team's output is other teams' velocity, so anything that slows a team down to satisfy the platform is a defect in the platform.

Q166 · Design. "Design the migration of a five-year-old application to a modern stack."

Reveal answer

Strong answer By not rewriting it, because a rewrite spends quarters producing what already exists while the old system still needs maintaining.

The approach is incremental, in four stages.

Establish the baseline first. What builds, what is tested, what the real user metrics say, which dependencies block an upgrade, and — most usefully — which parts the team is afraid to touch.

Upgrade in place to a supported framework version before anything else, because everything afterwards is easier from there and the official migrations do much of it.

Add tests around what will change, particularly the parts people fear, so the migration is verifiable.

Then strangle it feature by feature: new features and touched features in the new style, behind a shared shell so both coexist. Untouched code is left alone, because untouched code is not costing anything.

And a visible measure of progress, so it is a number rather than a feeling, with an explicit decision point about whether to finish or stop when the remaining code is genuinely inert.

Land it Converting only what you touch is the policy that finishes, because it never competes with feature work for a budget.

Q167 · Design. "Design a testing strategy for a team of twelve shipping daily."

Reveal answer

Strong answer The constraint shapes everything: twelve people shipping daily means CI must be fast enough to run on every push and trustworthy enough that red stops the line.

Fast gates on every push, targeting under five minutes: types, lint, unit and component tests, production build, bundle budgets, automated accessibility checks. Parallelised, with test selection by affected area.

A small end-to-end suite on the main branch — the five or six journeys whose failure would be an incident, against a production build. Not one per feature, because maintenance cost scales worse than value.

Post-deploy verification: a smoke test against the real environment plus alerting on error rate and Web Vitals, so problems that only appear in production are found by the system rather than a customer.

Zero tolerance for flakiness. A flaky test is quarantined the same day and fixed or deleted within the week, because the alternative is a team that ignores failures.

And a convention rather than a coverage target: every pull request that changes behaviour changes a test. That is reviewable; a percentage is gameable.

Land it With daily releases, a fast safe rollback is part of the testing strategy and is often worth more than the marginal end-to-end test.

Q168 · Design. "Design how a frontend team works with designers."

Reveal answer

Strong answer Around a shared design system, because that is what turns handover from a translation exercise into an assembly one.

Shared tokens, so the designer's spacing scale and the code's spacing scale are the same set of values with the same names. Most handover friction is a designer using a value that does not exist in code.

Design in components that map to real code components, so a screen is composed of things that exist rather than drawn freehand.

Engineers in design review, early, contributing what a static design cannot show: the states nobody drew, what it costs, and what breaks at the edges — long content, narrow screens, large text settings.

Designers in build review, so the implementation is checked against intent before it ships rather than after.

A shared definition of done that includes the four states, keyboard access and contrast, so those are not negotiated per feature.

The anti-pattern to name is the throw-over-the-wall handover, where a static image arrives with no states and no edge cases, and every gap is filled by an engineer guessing.

Land it Shared tokens remove most handover friction on their own, because the two sides stop speaking different dialects of the same design.

Q169. "How would you decide the frontend's quality bar for a startup versus an enterprise?"

Reveal answer

Strong answer By what the cost of being wrong is, and how long the code has to live.

A startup optimises for learning speed. Shorter-lived code, fewer people, and the product may pivot — so less structure, fewer abstractions, and a willingness to accept debt that can be paid if the thing survives.

An enterprise optimises for change over years by people who did not write it. More structure, enforced boundaries, more tests, more documentation — because the cost of a change in year three dominates the cost of writing it in year one.

What does not change with context, and I would defend this: accessibility, security, and not losing user data. Those are not a maturity level, and a startup that ships an inaccessible product has excluded users from day one.

What also does not change is the four states, because an application that silently fails generates more support work than the time it saved.

The mistake in each direction: enterprise ceremony at a startup slows learning; startup practices at an enterprise produce something nobody can change.

Land it The variable is how much structure, not whether the basics apply — and being clear about which is which is what makes the trade honest.

Q170 · Scenario. "You inherit a frontend nobody wants to work on. First week?"

Reveal answer

Strong answer Understanding and measuring, not changing.

Establish the baseline: does it build, do the tests pass, how long is CI, what is the bundle size, and what do real user metrics say.

Read the shape: the application's configuration for what is switched on, the route table for the feature map, the folder structure for whether boundaries exist.

Find the risk: unmaintained dependencies, anything bypassing sanitisation, secrets in the repository, and how much code is in very large files.

Ask the team what they are afraid to touch. That answer is worth more than any analysis, because it names the parts with no tests and no owner.

Then propose a sequence rather than a rewrite: upgrade to a supported version first, add tests around the feared areas, then modernise incrementally.

And fix one small visible thing in the first week, because a team that has seen the codebase improve once believes it can improve again.

Land it The instinct being tested is whether you propose a rewrite in week one — the answer that lands is a migration path with measurable checkpoints.

Q171. "What technical debt would you accept, and what would you refuse?"

Reveal answer

Strong answer I would accept debt that is local, visible and reversible, and refuse debt that spreads or removes evidence.

Accept: a duplicated component that will be unified when a third case appears; a screen with less polish; a feature built for one case rather than generalised; missing tests on something genuinely trivial; a hard-coded value with a comment and a ticket.

Refuse: anything that makes a real bug harder to find later — suppressing an error rather than fixing its cause, disabling type checking to unblock a compile, adding a workaround that hides a mutation problem. Also anything touching security, data loss or accessibility, and any abstraction that would have to be unpicked from forty files.

The distinction is whether the debt is contained. A duplicated component is a known cost in a known place. A disabled compiler check is an unknown cost everywhere.

And I would make the trade explicit to whoever owns the deadline, rather than absorbing it silently — because it is their decision and it has a cost.

Land it The test is whether the shortcut makes the real problem harder to find, because that is the debt that compounds rather than sits still.

Q172. "How do you review a frontend pull request?"

Reveal answer

Strong answer In order from expensive-to-fix-later to cheap, because a review that only reaches naming has not really been a review.

State ownership. Who writes this value, and can anyone else? A new provider or a component mutating something it was given are the things that cost days later.

Cleanup. Every subscription, listener and third-party widget — torn down, and next to the setup?

The four states. If it fetches, does the template handle loading, error, empty and populated, and is error distinguishable from empty?

Accessibility basics. Native elements, labels, focus visible, keyboard reachable.

Cost. A new dependency, an object literal in a binding, a missing list key or track, work in the render path.

Then naming, structure and tests.

What I try not to do is lead with style, because style comments are easy to write and crowd out the two observations that mattered — and the author learns to skim.

Land it Two substantive comments beat twenty stylistic ones, because the author reads the first two and skims the rest.

Q173. "What would make you say a frontend team is doing well?"

Reveal answer

Strong answer Six observable things, none of which is about which framework they use.

They ship regularly and can roll back quickly. The second matters more than the first.

Nobody is afraid of any part of the codebase. Fear names the parts with no tests and no owner, so its absence is a strong signal.

Performance and accessibility are defended by automation rather than by individuals remembering.

New joiners are productive within two weeks, which means the conventions are real and discoverable.

Reviews are about behaviour, not structure, because structure has been settled.

They know their real user metrics, segmented, and can say what the median user experiences.

What I would not use as a signal: velocity numbers, test coverage percentage, or the modernity of the stack — all three are easy to optimise without anything improving.

Land it "Nobody is afraid of any part of it" is the single best proxy, because every other quality problem eventually shows up as fear.

Q174. "What would you want to be judged on as a senior frontend engineer?"

Reveal answer

Strong answer Four things beyond writing the code well.

Decisions that were still good a year later. Not decisions that seemed clever at the time, but ones the team was glad of when the product changed.

What I chose not to build. Most of the value in a senior role is scoping — noticing that the request for collaborative editing is satisfied by presence indicators, or that the table needs pagination rather than virtualisation.

Whether other people got faster. Conventions that removed decisions, reviews that caught expensive things, a reference implementation people copied.

Whether the things I owned failed well. Not whether they never failed, which is not achievable, but whether failures were visible, diagnosable and recoverable.

What I would not want to be judged on: volume of code, or how modern the stack is. Both are easy to maximise while making the product worse.

Land it A senior engineer is judged on the decisions, not the code — and specifically on the ones that were still right after the product changed.

Q175 · Design. "Design the frontend for a product you would be proud of in five years. What matters?"

Reveal answer

Strong answer Over five years the framework will change under me at least twice, so I would optimise for what survives that.

Keep the framework at the edges. Business logic in plain TypeScript with no framework imports, API clients and domain models framework-free, design tokens as CSS. Then a migration is rewriting the view layer against logic that still works — and the same separation is what makes it testable today.

State ownership that is obvious. For any value on screen, one place writes it. This is the property that most decides whether the code is still changeable in year three.

Boundaries enforced in tooling from day one, because retrofitting them at year two is a project.

The basics never traded away: the four states everywhere, accessibility in the design system, and no user data lost.

Boring dependencies, preferring the platform, because every dependency is a five-year commitment.

A maintenance budget so keeping current never competes with features.

And what I would be proudest of is not visible in the code: that a new engineer in year four can change any part of it without being afraid, and that the product works for people on a cheap phone with a screen reader on a bad connection.

Land it None of the decisions that pay over five years are the framework choice everyone argues about — they are separation, ownership, enforced boundaries and a maintenance budget.

Likely follow-ups
"Is that not over-engineering for an early product?"

Most of it is not, because most of it is free at the start and expensive later. Keeping business logic out of components costs nothing on day one and is a rewrite in year two. So is a token layer, and so are lint rules on imports.

What would be over-engineering is the things I listed as refusals elsewhere: micro-frontends, a custom state library, an abstraction over the framework, and a design system before there are screens to base it on.

The distinction I use is whether it is cheap now and expensive later. Those are worth doing early; everything else waits for evidence.

17 · RecapWhat You Can Do Now

  • You can decide where a component ends using ownership and the one-reason-to-change test, rather than by line count
  • You can separate the four kinds of state, explain why server data in a hand-maintained store is the expensive mistake, and describe the escalation ladder with the pressure that moves you up it
  • You can choose between client rendering, prerendering, server rendering and incremental delivery from two questions, and explain hydration as the gap between content and interactivity
  • You can explain React Server Components accurately to an Angular developer, and Angular's incremental hydration to a React developer
  • You can diagnose a slow page by budget — download, startup, interaction — and name the tool that answers each question
  • You can build a design system in three layers, name tokens by role rather than appearance, and explain why CSS custom properties cross boundaries that selectors cannot
  • You can name why one card looks better than another: one spacing scale, proximity carrying the grouping, alignment, and hierarchy from weight and colour rather than size
  • You can set a measure in ch, choose line height by role, and build three levels of hierarchy without making anything large
  • You can build a palette of about eighteen values, state the contrast thresholds from memory, and explain why dark mode is not an inversion
  • You can design all seven states of an interactive element, defend :focus-visible in review, and distinguish the three empty states
  • You can treat accessibility as design work done earlier, name the five failures automation misses, and describe the three testing layers
  • You can answer 175 questions out loud, and structure a design answer as clarify, design, trade off, refuse

There are no dumb questions

I am an engineer, not a designer. Is the craft half really my job?
In most teams, yes — not because you should be doing a designer's job, but because a hundred design decisions a week are made in code regardless. Every padding value, font size and hover state is decided by whoever writes the CSS. The craft half is not about producing designs; it is about implementing them faithfully and filling the gaps a static design cannot cover.
Do I need to know both Angular and React to be employable?
No — most roles want one. But knowing the second one well enough to explain it accurately is worth a lot in interviews, because it demonstrates that your opinions about the first are informed rather than tribal. And the architecture and craft in this chapter transfer completely, which is the majority of what a senior role is judged on.
How much of this comes up in an actual interview?
The architecture half is reliable: state, rendering strategy, performance and component design come up in nearly every senior frontend round. The framework comparison comes up whenever your background differs from theirs. The visual half varies — some companies never ask, and the ones that do use it to separate candidates sharply, because so few can answer.
The design questions have no single answer. How am I graded?
On four things: whether you ask what the requirements are before designing, whether you name trade-offs rather than presenting a design as obviously correct, whether you can say what you would not build, and whether the answer survives one follow-up. A confident wrong answer scores worse than an uncertain one that reasons out loud.
Everything I read about React or Angular contradicts something else. How do I know what is current?
Check the date first — anything before 2024 predates signals, zoneless, Server Components and the React Compiler, and describes a genuinely different set of trade-offs. Then prefer the official documentation and release notes over blog posts, and treat benchmark comparisons with suspicion, since both frameworks are far faster than any real application needs and the differences are dominated by application decisions.
Where should I practise the visual half?
On interfaces you already admire: open the inspector and read the actual values — the spacing scale, the type sizes, the number of colours. It is usually far simpler than it looks, and seeing that is what makes it reproducible. Then build something with one font, three type sizes and five colours, because constraints teach faster than freedom.
🧠 Flex your memory

Close the page and write down, from memory: the four kinds of state and who owns each; the two spacing rules that explain most of why one layout looks better than another; and the seven states of an interactive element. Then reach back to Chapter E15 and Chapter E6: explain how a checkout's idempotency key, a resource cancelling a superseded request, and a store's read-only public view are all the same idea — bounding the number of places a wrong outcome could have come from.