tezvyn:

🌐Frontend Dev

Frontend web development and UI engineering

498 bites

React & Next.js30 sec read

Explain the difference between React.memo and useMemo

WHAT IT TESTS: whether you distinguish component-level memo from value caching. ANSWER OUTLINE: React.memo skips re-renders when props match; useMemo caches a computed value between renders. RED FLAG: saying they are interchangeable or both stop re-renders.

React & Next.js30 sec read

Design a multi-step wizard form pattern in React

WHAT IT TESTS: shared state, step validation, and resilient navigation. A great answer uses one form instance with per-step Zod schemas, a context stepper, and localStorage persistence. Red flag: isolated forms per step that lose data on navigation.

React & Next.js30 sec read

Optimize a large form with frequent state updates

Tests render propagation and memoization discipline. Strong answers note parent updates re-render children, extract inputs to localize state, useMemo for derived values, and stable callbacks. Red flag: useMemo everywhere without component boundaries.

React & Next.js30 sec 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.

React & Next.js30 sec 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.

React & Next.js30 sec read

Prefer multiple useState or useReducer for multi-field forms?

WHAT IT TESTS: Matching state structure to complexity. OUTLINE: Separate useState for simple fields; one object for coupled validation or batch resets; useReducer for complex logic. RED FLAG: Picking one pattern for all forms without discussing coupling.

React & Next.js30 sec read

How do you handle a basic form submission in React?

Tests declarative form handling via controlled state. Nail it with onSubmit on the form, preventDefault to stop native reload, and state as the single source of truth. Red flag: reading values through refs or querySelector.

React & Next.js30 sec read

Explain controlled vs uncontrolled React form inputs and trade-offs

Tests state versus DOM ownership. Controlled inputs bind to React state via onChange; uncontrolled inputs read from DOM via refs. Trade-offs: reactivity, validation, complexity. Red flag: saying uncontrolled is easier while ignoring lost live validation.

React & Next.js30 sec 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.

React & Next.js30 sec read

Primary roles of BrowserRouter, Routes, and Route, and basic route setup

Tests v6 routing hierarchy. BrowserRouter provides history; Routes picks one match; Route maps path to element. Wrap Routes in BrowserRouter with nested Route elements for / and /about. Red flag: omitting the router or confusing Routes with Switch.

React & Next.js30 sec read

What is the fundamental difference between client-side and server-side routing?

WHAT IT TESTS: You know server routing fetches HTML pages, while client routing runs in the browser. ANSWER OUTLINE: Server routes return full documents and reload; client routes swap JS views and use the History API without server requests.

React & Next.js30 sec read

CSS Custom Properties vs JS Theme Object in React

Tests render overhead vs CSS cascade. Strong answers: CSS variables update styles without re-renders, while JS theme objects in Context force subtree re-renders. Mention scoping, SSR FOUC, and setProperty interop.

React & Next.js30 sec read

What is a stale closure in React hooks?

Tests closures and hook dependencies. A strong answer defines stale closure as capturing an outdated variable, shows a useEffect interval with stale state, and fixes it with dependencies and cleanup. Red flag: omitting cleanup or using refs blindly.

React & Next.js31 sec read

Describe combining useContext and useReducer for scalable feature state

This tests replacing prop drilling with a context-reducer pattern. A strong answer covers two contexts for state and dispatch, a provider wrapping the subtree, and a pure reducer. A red flag is one global context or async logic inside the reducer.

React & Next.js30 sec 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.

React & Next.js30 sec 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.

React & Next.js30 sec 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.

React & Next.js30 sec read

What is a custom hook? Write a simple useToggle example.

What it tests: Whether you see hooks as stateful logic extraction. Outline: Define a use-prefixed function calling hooks; write useToggle with useState and callback; explain extraction vs duplication. Red flag: Helpers without hooks or missing use prefix.

React & Next.js30 sec read

How does children work, and why is it fundamental to composition?

Tests React composition knowledge. Good answer: children is a prop holding nested JSX; a Card wrapper renders {children} to let parents inject markup; contrast with prop-driven text. Red flag: calling children magic syntax instead of a standard prop.

React & Next.js30 sec read

What is prop drilling in React?

WHAT IT TESTS: Awareness of coupling when props tunnel through indifferent layers. ANSWER OUTLINE: Define it as threading props through middle layers; give a three-layer example like a theme toggle; cite useContext. RED FLAG: Using Context for every prop.