Content & privacy
Frontend · INTERVIEW GUIDE

React & Next.js

Rendering, hooks, state ownership, performance, and server boundaries.

Practice this topic
Filters
5 questions

When should I use useEffect?

React & Next.js·Hooks

useEffect synchronizes a committed component with something outside React, such as a connection, timer or browser event listener. Its setup runs when relevant dependencies change, and cleanup ends the old synchronization. Effects are not the usual place to compute values already available during rendering.

Intermediate2 min read

Why does an effect run twice in development or loop forever?

React & Next.js·Hooks

React Strict Mode performs an extra development-only setup and cleanup cycle for effects to reveal missing cleanup. An infinite effect loop is a different issue, usually caused by updating state that keeps changing an effect dependency. Understanding the trigger helps fix the design rather than masking the behavior.

Intermediate2 min read

useRef vs useState?

React & Next.js·Hooks

useState stores a value that participates in the UI, while useRef stores a stable mutable container whose changes do not request rendering. A ref is useful for an imperative handle such as a DOM node or timer ID. It should not replace state for information that the screen must show when it changes.

Intermediate2 min read

useMemo vs useCallback?

React & Next.js·Hooks

useMemo caches a calculated value between renders until its dependencies change. useCallback preserves a function reference under the same dependency idea. They can reduce repeated work or unstable props, but memoization is an optimization rather than a correctness guarantee.

Intermediate2 min read

When do I use Context, useReducer or a custom hook?

React & Next.js·Hooks

Context shares a value with descendants without passing it through every intermediate component. useReducer organizes state changes through actions and a reducer, while custom hooks extract reusable stateful logic. These tools address distribution, transition structure and reuse respectively; they are not interchangeable state stores.

Intermediate2 min read

Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.