Random round

Random Interview Mode

Five questions, sampled across categories and difficulty. Click reroll for a new set. Simulates the surface area of a typical 60-minute round.

5 questions selected

1

How do concurrent rendering and transitions work in React 18?

Concurrent rendering lets React prepare multiple UI versions in the background. `useTransition` marks a state update as non-urgent so React can interrupt it for higher-priority work like typing.

react
hard
~12 min
2

How would you implement a polyfill for the useMemo hook?

`useMemo(factory, deps)` runs `factory()` on first render and again only when deps change (by `Object.is`); otherwise returns the cached value. Polyfill: store `{ value, deps }` in the component's hook slot array; on render, compare deps to previous; reuse or recompute.

react
easy
~20 min
3

How would you protect routes based on user roles, for example admin versus user?

Layered: server enforces (authoritative — API endpoints check role on every request); router-level guard component on the client checks role and redirects/denies; conditionally render UI elements (hide admin buttons for non-admins). Never trust the client — the client guard is UX only. Bake role into the auth token; refresh it when roles change.

react
medium
~20 min
4

How would you build a search feature with debounce and live API calls?

Controlled input → debounced query → fetch with AbortController → results. Must handle: debouncing the derived value (not the input), cancelling stale requests to fix out-of-order races, min query length, loading/empty/error states, and not re-creating the debounced fn each render.

machine-coding
easy
~20 min
5

What image optimization techniques do you use on the frontend?

Serve modern formats (AVIF/WebP), correct sizes via srcset, lazy-load below-the-fold, eager + fetchpriority='high' for the LCP image, reserve dimensions to prevent CLS, and use a CDN with on-the-fly resizing.

performance
medium
~12 min