Skip to content
tezvyn:

React & Next.js

React, Next.js, Remix, RSC, React ecosystem

70 bites

Test yourself: Top 30 intermediate React & Next.js interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Intermediate interview questions in React & Next.js

What is the purpose of React's key prop and index key risks?
intermediate2 min read

What is the purpose of React's key prop and index key risks?

This tests React reconciliation. Keys give stable identity to match components across renders and preserve state. Indices break on reorder or delete, causing state bugs. A red flag: saying keys are only for performance or indices are harmless.

Describe two patterns for conditional rendering in JSX
intermediate2 min read

Describe two patterns for conditional rendering in JSX

First, early return with if/else for branches; second, ternary or logical AND inside JSX for inline toggles.

What is a React Fragment and why use it over a div?
intermediate2 min read

What is a React Fragment and why use it over a div?

This tests JSX semantics and DOM hygiene. A strong answer says Fragments group children without wrapper nodes, preventing extra DOM and invalid HTML like divs in tables. A red flag is citing performance without mentioning DOM structure or semantics.

Explain prop drilling and why it's a problem
intermediate2 min read

Explain prop drilling and why it's a problem

Tests coupling in deep React trees. Good answers define prop drilling as forwarding props through unused intermediaries, cite coupling and refactor pain, and name Context or composition as fixes. Red flag: calling props bad or jumping to Redux without Context.

What will count be after three setCount calls in a row?
intermediate2 min read

What will count be after three setCount calls in a row?

Tests React state batching and stale closures. Answer: count is 1 because all three calls read the same closed-over value of 0. Fix: pass an updater function setCount(c => c + 1) three times so React queues each update.

How do you fetch data with useEffect and prevent memory leaks?
intermediate2 min read

How do you fetch data with useEffect and prevent memory leaks?

This tests useEffect async lifecycle and cleanup. A good answer places fetch inside useEffect, uses an ignore flag or AbortController to block state updates after unmount, and includes deps. A red flag is skipping cleanup and letting a late response set state.

What is the purpose of the useEffect cleanup function?
intermediate2 min read

What is the purpose of the useEffect cleanup function?

Explain cleanup prevents memory leaks by clearing timers or unsubscribing when dependencies change or on unmount.

Why pass a function to useState for expensive initial values?
intermediate2 min read

Why pass a function to useState for expensive initial values?

This tests your understanding of React's render-phase behavior. Without the function, expensive work reruns on every render and is thrown away; the initializer runs once only during mount.

Explain useReducer and when to prefer it over useState
intermediate2 min read

Explain useReducer and when to prefer it over useState

Tests if you know useReducer centralizes complex state transitions better than scattered useState. Answer: define reducer/dispatch, then contrast with useState via interdependent fields or deep updates. Red flag: calling it only for global state or Redux.

Use useContext to provide theme state without prop drilling
intermediate2 min read

Use useContext to provide theme state without prop drilling

This tests global state sharing without prop drilling. A strong answer uses createContext and a Provider with useState at the app root, then calls useContext in nested components. Red flag: ignoring re-render costs or placing the Provider too deep.

Explain the difference between useMemo and useCallback
intermediate2 min read

Explain the difference between useMemo and useCallback

This tests whether useMemo caches values while useCallback caches functions, and why that matters for React.memo. A strong answer notes React.memo uses Object.is, so a new inline function prop triggers a child re-render. Red flag: claiming they are the same.

Compare HOCs and custom hooks for sharing logic
intermediate2 min read

Compare HOCs and custom hooks for sharing logic

Tests your grasp of React's shift from wrapper-based to function-based logic reuse. Hooks eliminate wrapper hell and implicit props by extracting stateful behavior into plain functions without nesting components. Red flag: calling hooks just sugar.

intermediate2 min read

How would you create a styled Button accepting a variant prop

It tests prop interpolation for dynamic styling in CSS-in-JS. Good answers use styled.button with a function reading props.variant to map CSS rules in one component. A red flag is splitting into separate components per variant or using inline styles.

intermediate2 min read

Implement a light/dark theming system with CSS-in-JS and React Context

This tests React Context architecture with CSS-in-JS theme injection. Strong answers include: a Theme Context with mode and toggle; ThemeProvider at the app root; consumption via useTheme or props.theme.

intermediate2 min read

Implement a protected /dashboard route in React Router

Tests declarative route guards versus imperative redirects in React Router 7. Strong answer: reusable ProtectedRoute wrapper with Navigate replace, auth state above Routes, and role checks.

How do you create a dynamic route like /products/:productId in React Router?
intermediate2 min read

How do you create a dynamic route like /products/:productId in React Router?

Tests React Router v6 dynamic segments and useParams. A strong answer declares path="products/:productId" on a Route, then extracts productId with useParams in the component. Red flag: using v5 props.match.params or manual URL parsing instead of the hook.

intermediate2 min read

Compare Pages Router and App Router file-based routing conventions and capabilities

Tests your grasp of the folder-as-route paradigm shift. A strong answer notes that Pages files are routes while app folders are segments requiring page.js, and cites layout.js, loading.js, and error.js as nested primitives.

Prefer multiple useState or useReducer for multi-field forms?
intermediate2 min read

Prefer multiple useState or useReducer for multi-field forms?

Separate useState for simple fields; one object for coupled validation or batch resets; useReducer for complex logic.

How would you implement real-time client-side validation in React?
intermediate2 min read

How would you implement real-time client-side validation in React?

Tests state-driven UI thinking over imperative DOM updates. A strong answer uses a status enum like typing or error, derives validation from state instead of redundant booleans, and conditionally renders feedback.

Advantages of dedicated React form libraries over manual state
intermediate2 min read

Advantages of dedicated React form libraries over manual state

Your grasp of the hidden costs of fully controlled form state in React. Mention re-render reduction via refs, declarative validation, less boilerplate, and custom input support.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles