React: patterns, error boundaries and app architecture, Server Components, SSR and Suspense, forms, events and React 19 actions, rendering, memoization and the React Compiler, refs, context, reducers and custom hooks, effects and synchronization, state, immutability and updates, lists, keys and conditional rendering, JSX, components and props – Front End interview prep

2,599 interview-style multiple-choice questions on React: JSX, components, hooks, state, effects, refs, context, reducers, rendering, forms, events and React 19 actions, Server Components, SSR and Suspense, patterns, error boundaries and app architecture, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 94 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 6.1 JSX, components and props
  2. 6.2 Lists, keys and conditional rendering
  3. 6.3 State, immutability and updates
  4. 6.4 Effects and synchronization
  5. 6.5 Refs, context, reducers and custom hooks
  6. 6.6 Rendering, memoization and the React Compiler
  7. 6.7 Forms, events and React 19 actions
  8. 6.8 Server Components, SSR and Suspense
  9. 6.9 Patterns, error boundaries and app architecture

Key terms

6.1 JSX, components and props

Automatic JSX runtime
Modern JSX transform that compiles to jsx() or jsxs() from react/jsx-runtime, so React need not be in scope
children
The prop that holds what a parent nested between a component's tags, or passed as an explicit children prop
cloneElement
React.cloneElement returns a new element of the same type with merged props, leaving the original unchanged
Component
Function that returns UI from props
Composition
Building UI by nesting components and passing children
createElement
React.createElement(type, props, ...children); classic JSX compiles to this and it returns an element object
Fragment
Wrapper that groups children without a DOM node
Host component
A built-in platform element such as div or span, written as a lowercase JSX tag
JSX
Syntax that compiles to calls creating React elements
key
A stable identifier React uses to match list items between renders
Lifting state up
Moving shared state to the nearest common parent
Props
Read-only inputs a parent passes to a child component
React.Children
Helpers (map, toArray, count, only, forEach) for walking the opaque children prop
Render prop
Prop that's a function returning UI

6.2 Lists, keys and conditional rendering

Conditional rendering
Choosing UI with ternaries, `&&` or early returns
Index as key
Using a list item's array index as its React key; safe only when the list is static and never reorders, filters, or inserts
Keyed remount
Changing a component's key so React unmounts the old instance and mounts a new one, which resets its state
Short-circuit rendering
The {condition && <Component />} JSX pattern, which can render a falsy value such as 0 instead of skipping the UI
Stable key
A key that stays with the same item across renders, typically a unique id from the data rather than a position

6.3 State, immutability and updates

Automatic batching
React 18+ grouping several updates into one render
Derived state
Value computable from props or state
Immer
Library that turns draft mutations into immutable updates
Immutable update
Producing a new object or array reference instead of mutating the current state
Lazy initial state
Passing a function to useState so the seed runs on mount, not on every render
State colocation
Keeping state as close as possible to the UI that uses it
State snapshot
The state variable for a render is a constant; setters schedule a later render rather than changing it in place
Updater function
Function passed to a setter that receives the previous state

6.4 Effects and synchronization

Cleanup function
Function returned by an effect to undo it
Dependency array
List of reactive values that decide when an effect or memo re-runs
Reactive value
Props, state, and anything computed from them that can change between renders and must be listed when an effect reads it
Stale closure
A callback that keeps old values because it was created in an earlier render
Strict Mode
Development mode that double-invokes renders and effects to expose bugs
Tearing
In concurrent React, different parts of the UI showing different values of the same external store in one render
useEffect
Runs side effects after render to sync with external systems; can return a cleanup
useEffectEvent
Hook for effect logic that reads fresh values without re-running
useInsertionEffect
Fires after DOM updates and before layout effects so CSS-in-JS libraries can insert styles
useLayoutEffect
Runs after DOM updates and before the browser paints, so measurements and DOM writes can happen without flicker
useSyncExternalStore
Hook to read external stores safely in concurrent React

6.5 Refs, context, reducers and custom hooks

Callback ref
A function passed as the ref prop, called with the node on attach and with null on detach
createContext
Function that returns a context object used by a provider and by useContext or use
Custom hook
A function starting with use that reuses stateful logic
forwardRef
Helper that lets a function component receive a ref to attach or customize
Rules of Hooks
Call hooks only at the top level of a React function, in the same order every render
use
React 19 API that reads a promise or context
useContext
Hook that returns the current value from the nearest matching context provider
useId
Hook giving stable unique IDs across server and client
useImperativeHandle
Hook that customizes the instance value a parent sees on a ref
useMemo / useCallback
Cache a computed value or a function between renders until dependencies change
useReducer
Hook managing state through a reducer and dispatch
useRef
Hook for a mutable value that persists across renders without re-rendering
useState
Hook that adds a state variable; setting it schedules a re-render

6.6 Rendering, memoization and the React Compiler

"use no memo"
Compiler directive that skips optimizing a function, or a whole module if used at the top of the file
Code splitting
Loading parts of the app only when needed, with React.lazy and Suspense
Concurrent rendering
React can interrupt and resume rendering so urgent updates stay responsive
Fiber
Unit of work in React's reconciler
Hydration
Attaching React to server-rendered HTML on the client
React Compiler
Build-time tool that auto-memoizes React code
React.memo
Skips re-rendering a component when its props are shallowly equal
Reconciliation
React diffing the new element tree against the old one to update the DOM
Shallow compare
Object.is on each prop or dependency, not a deep equal of nested fields
startTransition
API that marks the updates scheduled in its callback as non-urgent
useCallback
Hook returning a stable function between renders
useDeferredValue
Hook returning a lagging copy of a value
useTransition
Hook that returns an isPending flag and a startTransition function
Virtual DOM
The tree of element objects React builds and compares each render

6.7 Forms, events and React 19 actions

Controlled input
Input whose value is driven by React state
Form action
A URL or function passed to a form's action prop
FormData
Browser API for a form's name/value pairs and files
Progressive enhancement
A form still submits as a native post when JavaScript has not loaded
requestFormReset
react-dom helper that resets a form programmatically
Synthetic event
React's cross-browser wrapper for native events
Uncontrolled input
Input whose value lives in the DOM until you read it
useActionState
React 19 hook tracking an action's result and pending state
useFormStatus
react-dom hook for a parent form's in-flight submission
useOptimistic
React 19 hook for temporary optimistic UI

6.8 Server Components, SSR and Suspense

"use client"
Directive marking the client boundary
"use server"
Directive that marks Server Functions the client can call over the network
hydrateRoot
Client API that attaches React to server-rendered HTML and makes it interactive
renderToPipeableStream
Node SSR API that streams HTML as Suspense boundaries resolve
Selective hydration
Hydrating parts of the tree as they become available, prioritizing what the user interacts with
Server Component
Component rendered only on the server, with no client JS
Server Function
A function marked with "use server" that client code can invoke over the network as a public endpoint
Streaming SSR
Sending HTML in chunks as Suspense boundaries resolve, so the shell can flush before every leaf is ready
Suspense
Boundary showing a fallback while children wait

6.9 Patterns, error boundaries and app architecture

asChild
Merge a primitive's behavior and props onto its single child element
Compound component
Related components that share implicit state through a parent
Design system
Shared, documented UI primitives, tokens, and usage rules
Error boundary
Component catching render errors below it
getDerivedStateFromError
Static class lifecycle that returns state used to render a fallback
Headless component
Component with behavior and accessibility but no styles
Higher-order component
Function that wraps a component to add behavior
Micro-frontend
An independently deployed slice of UI composed into a larger product
Portal
Rendering into a different DOM node while keeping React context
Provider pattern
Supplying capabilities to a subtree through a wrapper, usually context

Sample practice questions

  1. What does JSX like `<Button color="red">Save</Button>` compile to?

    1. A function call that creates a React element object
    2. A template the browser parses from a script tag
    3. A Web Component registered with the browser
    4. An HTML string that React inserts with `innerHTML`

    Answer: A. A function call that creates a React element object JSX is syntax for creating plain element objects that describe the UI; React then renders them.

  2. Why must a list of rendered items have a `key` prop?

    1. So each list item can be styled with its own CSS class
    2. So each list item becomes focusable for keyboard users
    3. So React can send the list to the server for caching
    4. So React can match items between renders and keep the right state

    Answer: D. So React can match items between renders and keep the right state Use a stable id from the data. Array indexes break when the order changes.

  3. What is "lifting state up"?

    1. Storing state on `window` so every component can reach it
    2. Converting a function component into a class component
    3. Moving shared state to the closest common parent
    4. Moving state into a CSS custom property

    Answer: C. Moving shared state to the closest common parent It keeps a single source of truth when two components need the same data.

  4. What is `useEffect` for?

    1. Changing state on every render to stay fresh
    2. Handling button clicks and other user events
    3. Syncing with things outside React, like timers or requests
    4. Computing values from props during render

    Answer: C. Syncing with things outside React, like timers or requests If the value can be computed from props or state, compute it during render instead of in an effect.

  5. Which rule of hooks does this break? ```jsx if (user) { const [name, setName] = useState(user.name); } ```

    1. Hooks must run at the top level, in the same order, never in conditions
    2. Hooks can only be called inside class components, never in functions
    3. `useState` can't take its initial value from a prop the component got
    4. Hooks must always be called from inside a `useEffect` callback first

    Answer: A. Hooks must run at the top level, in the same order, never in conditions React identifies hooks by call order, so a conditional call shifts every hook after it.

  6. What does `useMemo(() => expensive(a, b), [a, b])` do?

    1. Runs `expensive` once on mount and never again
    2. Caches the result and recomputes only when `a` or `b` change
    3. Caches the function itself, not the result it returns
    4. Runs `expensive` in a web worker off the main thread

    Answer: B. Caches the result and recomputes only when `a` or `b` change `useCallback(fn, deps)` is the same idea for keeping a stable function reference.

  7. What is the difference between a controlled and an uncontrolled input?

    1. Uncontrolled inputs aren't allowed inside forms
    2. Controlled inputs only exist for checkboxes and radios
    3. Controlled inputs can't be edited by the user at all
    4. Controlled: value lives in React state; uncontrolled: it lives in the DOM

    Answer: D. Controlled: value lives in React state; uncontrolled: it lives in the DOM Controlled inputs make validation and formatting easy; uncontrolled ones are simpler for basic forms.

  8. How do `React.lazy` and `<Suspense>` help performance?

    1. The component loads in its own bundle on first render
    2. They memoize every component automatically
    3. They move rendering into a web worker
    4. They prefetch every route at startup

    Answer: A. The component loads in its own bundle on first render Code splitting shrinks the initial JavaScript the user downloads.

  9. What is an error boundary?

    1. A lint rule that blocks code that might throw
    2. A browser feature that hides crashed iframes
    3. A try/catch block React adds around every event handler
    4. A component that catches render errors below it and shows a fallback

    Answer: D. A component that catches render errors below it and shows a fallback It's a class with `getDerivedStateFromError` or a library like react-error-boundary.

  10. Props in React are:

    1. Read-only inputs from the parent; a component mustn't change them
    2. Limited to strings and numbers, like HTML attributes
    3. Mutable values a child changes to send data back to its parent
    4. Global variables shared by every component in the app

    Answer: A. Read-only inputs from the parent; a component mustn't change them To change data, the parent owns state and passes down both the value and a callback.

Practice all 2,599 questions

More Front End