Programming flashcards

React Hooks Essentials

40 React 19.2 hooks flashcards covering effects, state, refs, transitions, actions, external stores, and pitfalls.

40 cards By @mazo
#react#hooks#react-19#frontend#pitfalls
Study this deck free Browse Programming

About this deck

This 40-card React hooks deck is aligned with React 19.2. It covers core state, context, ref, effect, and performance hooks plus actions, optimistic state, external stores, Effect Events, and common design mistakes.

The deck emphasizes when not to use an Effect or memo hook, because choosing the wrong abstraction is a more common problem than forgetting a hook name.

40cards
React beginner to intermediatelevel
React developers, frontend learners, and interview candidates using modern Reactaudience

What you will learn

How to study this deck

Recommended study setup

Scope

This deck targets stable React 19.2 APIs and design guidance. Canary-only APIs, framework-specific data loading, and React internals are out of scope.

Review notes

Hook list and guidance checked against official React 19.2 documentation on 2026-07-10.

All 40 cards in this deck

FrontBackStudy note
useStateStores local component state and provides a setter.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useEffectRuns side effects after render, such as subscriptions or data loading.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useLayoutEffectRuns synchronously after DOM mutations, before the browser paints.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useContextReads a value from a React context without prop drilling.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useMemoMemoizes an expensive computed value between renders.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useCallbackMemoizes a function reference between renders.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useRefStores a mutable value that does not trigger re-render when changed.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useReducerManages state with a reducer function for more structured updates.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useIdGenerates a stable unique id for accessibility attributes.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useTransitionMarks state updates as non-urgent to keep the UI responsive.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
Custom hookA reusable function that calls hooks and encapsulates component logic.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
Effect cleanupA function returned from useEffect to remove listeners, timers, or subscriptions.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
Dependency arrayThe list of values that decide when an effect or memo recalculates.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
Rules of hooksCall hooks at the top level of React functions, not inside loops or conditions.Design cue: name the external system, state transition, or render optimization that justifies this hook before using it.
useDeferredValueDefers updating a non-critical value so urgent UI can render first.The deferred value lags behind; it does not impose a fixed time delay.
useSyncExternalStoreSubscribes safely to data stored outside React.Use for external stores or browser APIs that support subscriptions.
useImperativeHandleCustomizes the value exposed through a ref.Rarely needed; prefer declarative props when possible.
useDebugValueAdds a label for a custom hook in React DevTools.Most useful inside reusable library hooks.
useInsertionEffectRuns before React makes DOM changes so libraries can insert styles.Intended mainly for CSS-in-JS library authors, not normal app effects.
useActionStateManages state produced by an Action and exposes whether it is pending.Useful for forms and async actions in React 19.
useOptimisticShows an optimistic state while an Action is in progress.Reconcile or roll back when the real result arrives.
useEffectEventCreates non-reactive logic that can be called from an Effect.Do not use it to hide real dependencies; it is for logic that should read latest values without resubscribing.
use APIReads a Promise or context resource during render.Unlike Hooks, use can appear in loops or conditions, but it still must run inside a component or Hook.
startTransitionMarks state updates as non-urgent outside a component hook.Use useTransition when the component also needs an isPending value.
useFormStatusReads the status of a parent form submission from react-dom.It must be rendered inside the form whose status it reads.
When is an Effect unnecessary?When a value can be derived during render or logic belongs in an event handler.Effects are for synchronization with external systems.
Derived stateCompute it from props and state during render instead of storing a duplicate.Duplicated state can drift out of sync.
Functional state updatePasses a function such as setCount(c => c + 1).Use when the next state depends on the previous state.
Immutable state updateCreates a new object or array instead of mutating existing state.React compares references to decide what changed.
Ref versus stateUse a ref for values not used to render; use state for visible data.Changing ref.current does not trigger a re-render.
Stale closureA callback reads values captured by an older render.Correct dependencies or functional updates usually solve it.
exhaustive-depsLint rule that checks reactive values used by Effects and memo hooks.Restructure code instead of suppressing the rule by default.
Effect dependency comparisonReact compares dependencies with Object.is.New object or function references can make an Effect run again.
useMemo caveatIt is a performance optimization, not a semantic guarantee.Code should still be correct if React discards the cached value.
useCallback caveatIt caches a function reference, not the function result.It helps only when reference stability has a real consumer.
Reducer dispatchDescribes an event to a reducer instead of directly calculating state in the component.Reducers help when transitions are complex or related.
Custom hook namingA custom hook name starts with use.This convention lets lint rules enforce Hook usage.
Hooks in Server ComponentsState and Effect hooks require a Client Component.Server Components can use server-compatible APIs but do not run browser effects.
Suspense and useReading a pending Promise with use suspends to the nearest Suspense boundary.Provide a useful fallback and error handling around async resources.
StrictMode Effect checkDevelopment Strict Mode runs an extra setup-cleanup cycle.This reveals missing cleanup; production does not keep the extra cycle.

Frequently asked questions

Is this React hooks deck current for React 19?

Yes. It includes stable React 19.2 hooks such as useActionState, useOptimistic, and useEffectEvent.

Does it include useEffect pitfalls?

Yes. It covers cleanup, dependencies, stale closures, Effect Events, and cases where no Effect is needed.

Are Canary APIs included?

No. The scope is stable React 19.2 and closely related stable react-dom hooks.

Is the React Hooks Essentials flashcard deck free?

Yes. You can study it free in your browser on MazoCards. Create a free account to save progress, track streaks, and sync across devices.

Git Commands Cheat Sheet

50 practical Git command flashcards for commits, branches, inspection, recovery, collaboration, and debugging history.

50 cards
Open

JavaScript Array Methods

50 JavaScript array method flashcards covering transformation, search, mutation, copying methods, iteration, and common pitfalls.

50 cards
Open

SQL Basics: Queries & Joins

50 SQL flashcards covering queries, filtering, joins, aggregation, subqueries, CTEs, windows, transactions, constraints, and query plans.

50 cards
Open

CSS Flexbox and Grid

CSS layout flashcards covering Flexbox, Grid, alignment, tracks, gaps, and responsive patterns.

41 cards
Open

Start studying React Hooks Essentials

Study these 40 cards free, then create an account to save your progress and build a streak.