Skip to content
tezvyn:

React

262 bites tagged React — interview questions with model answers, and 60-second explainers.

React & Next.js2 min read

Server vs. Client Components in Next.js

Next.js forces a render boundary. Server Components generate HTML without sending JavaScript, while Client Components ship JS for interactivity. The footgun is importing a heavy library into a Server Component via a child, bloating the client bundle.

React & Next.js2 min read

Rules of Hooks: Call Order Is Sacred

Hook calls must keep the same order every render because React maps them to state by array index. Only call hooks at the top level of React functions. Break the order and React desyncs, producing stale state or crashes.

React & Next.js2 min read

React Reconciliation: The Virtual DOM Diff

React diffs a lightweight in-memory tree against the next render to apply only surgical changes to the real DOM. It fires on every state or prop change. Missing keys in lists force React to rebuild more nodes than needed, destroying performance.

React & Next.js2 min read

The act Utility in React Testing Library

React Testing Library re-exports everything from DOM Testing Library and explicitly lists act as a core top-level API method alongside render and renderHook, making it available as a named export from the framework package without requiring a separate wrapper.

React & Next.js2 min read

Protected Routes: Server Gates, Not Hidden Links

A protected route is a server-enforced gate, not a hidden link. In Next.js, middleware or server components validate sessions before HTML ships, which matters for dashboards and billing.

React & Next.js2 min read

Lists and Keys in React

React turns arrays into UI with map, yet each child needs a unique key prop or you get console warnings. Filter first, then map. The footgun: forgetting keys or failing to include stable unique IDs in your source data.

LLMs & Generative AI2 min read

Describe a ReAct agent architecture for multi-step dependent tool calls

Sketch ReAct's thought-action-observation cycle; keep state in an append-only trajectory; re-plan after each observation. Designing loops that interleave reasoning and tool use across steps.

Design Systems2 min read

Design a type-safe polymorphic component that renders as different HTML elements

Tests TypeScript generics and prop forwarding in design systems. Answer: generic as constrained to keyof JSX.IntrinsicElements, merged with ComponentPropsWithoutRef<C>, omit clashes, forward ref with ElementRef.

Design Systems2 min read

How would you structure a flexible Card component API?

Tests composition-over-configuration thinking in design systems. A strong answer uses compound components or slots so consumers reorder or omit title, image, and body freely without prop drilling. Red flag: rigid boolean props that freeze layout order.

Design Systems2 min read

When should data in a reusable component be a prop or state?

This tests controlled versus uncontrolled patterns. Great answers ask who owns the data: props when parent must drive or observe it, state only for private details.

Content & Copywriting2 min read

Propose two strategies for lazy-loading SPA localization data

This tests code-splitting for i18n. Strong answers cover: first, per-locale dynamic imports creating separate chunks per language; second, namespace splitting fetching only keys for active UI. Red flag: ignoring bundler chunking or Core Web Vitals impact.

Analytics & Metrics2 min read

How do you track page views in a Single Page Application?

Tests your grasp of SPA navigation vs. traditional page loads. A great answer explains how SPA routers use the History API (`pushState`) and how to listen for changes to send analytics events. A red flag is suggesting polling the URL.

Analytics & Metrics2 min read

How do you track page views in a Single Page Application?

This tests your grasp of SPA routing mechanics. A great answer covers both programmatic navigation (using router hooks) and browser history events (`popstate`), explaining why both are necessary.

Vue, Angular & Svelte2 min read

Container vs. Presentational: A Component Separation Pattern

Split components into 'smart' containers that handle data and logic, and 'dumb' presentational components that just render UI. This lets you reuse state across different views, like showing a product list in a grid or a table.

Vue, Angular & Svelte2 min read

Framework Reactivity: Coarse vs. Fine-Grained Updates

Frameworks sync UI and state differently. Coarse-grained systems like React re-run component code, while fine-grained systems like Vue (Proxies) or Angular (Signals) track dependencies to update only what's needed.

Vue, Angular & Svelte2 min read

Headless Components: Separate Logic from UI

A Headless Component separates a component's logic from its UI, providing the 'brain' without the 'looks'. Use it for complex elements like dropdowns that need consistent behavior but different visual styles. The footgun is assuming it's a drop-in UI.

React & Next.js2 min read

Zustand's `create`: A Factory for Global State Hooks

Zustand's `create` function is a factory for your global state. You define your state and actions, and it returns a custom hook to access them anywhere in your app, avoiding prop drilling. The footgun: `set` shallow-merges state by default.

React & Next.js2 min read

Memoizing Selectors: Avoid Needless Re-renders

Memoized selectors prevent needless re-renders by caching derived data. A selector for a filtered list will only re-run its logic if the original list or filter criteria change, not on every state update.

React & Next.js2 min read

React Router Data Loaders: Fetch Before You Render

React Router loaders fetch data *before* a component renders, eliminating loading spinners inside your UI. Use them to load data for a new route in parallel with its code. The footgun: forgetting that loaders must run in both server and browser environments.

React & Next.js2 min read

The useSearchParams Hook for URL Queries

The useSearchParams hook gives your client component read-only access to the URL's query string. Use it to build UIs that react to URL changes, like filtering a list or displaying search results.

React & Next.js2 min read

useNavigate: Programmatic Navigation in React

The `useNavigate` hook gives you a function to change routes from your component's logic, like after a form submission. Use it for event-driven navigation, such as sending a user to their dashboard after login.

React & Next.js2 min read

useParams: Accessing Dynamic URL Segments

The `useParams` hook lets client components read dynamic URL segments. On a route like `/posts/[slug]`, it returns an object like `{ slug: 'my-post' }`. Remember, it's for client components only and won't see query strings.

React & Next.js2 min read

The <Route> Component: Mapping URLs to UI

The <Route> component is like a switch statement for your UI, telling your app 'when the URL is X, render component Y'. It's used to define pages like `/dashboard` or `/users/:id`. The footgun is forgetting it must live inside a `<Routes>` component.

React & Next.js2 min read

React's Internal Scheduler Package

React's scheduler is an internal traffic cop that breaks up rendering work to keep the UI from freezing. It's used to prioritize updates and yield to the browser, but its public API is unstable and not for direct use in your app.

Get React bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.