Quick recap · Cheat sheet ☷ Flashcards
Quick recap

The whole thing on one page

Every question with its one-line answer. Click any question to open the full explanation. Print this (or save as PDF) for the last hour before the interview.


The 16 things to be sure of

If you remember nothing else, remember these.

1React is a library — UI only. Routing, state and HTTP are separate choices.
2A re-render re-runs the function and diffs; only real differences reach the DOM.
3Re-render causes: state · props · parent · context · key. The parent is the one people forget.
4useEffect: [] = mount, [x] = when x changes, no array = every render. Return the cleanup.
5useMemo caches a value, useCallback a function. Both are pointless without React.memo or a dep array.
6Measure before optimising. Don't memoize by default — React 19's compiler does it anyway.
7Keys need stable ids. Index keys move state to the wrong row when the list changes.
8Update state immutably — React compares references with Object.is.
9API logic lives in a service layer; the token is attached in one API client.
10Client validation and protected routes are UX. The server is the security.
11Render all four states: loading · error · empty · content.
12Error boundaries catch render errors only — never API calls or event handlers.
13queryKey = cache identity + dependency array. Everything the queryFn uses must be in it.
14Write → useMutation → invalidateQueries. Optimistic = onMutate snapshot, onError rollback, onSettled invalidate.
15App wiring: index.html (#root) → main.tsx (createRoot + providers) → App.tsx (routes) → layout → page → service → api client.
16Auth Code + PKCE for SPAs — a browser app can't keep a secret, and the implicit flow is dead. Send the access token, not the ID token.

Words to use (they signal seniority)

reconciliation · referential equality · stale closure · race condition · server state vs client state · trust boundary · single source of truth · separation of concerns · measure first · trade-off · idempotent · virtualization