React problems.
Solved in 5 minutes each.
Every page here answers one specific question — the exact thing you typed into Google. No filler. Just the answer, working code, the reason it works, and the mistakes to avoid. This is what you need at 2 AM when React throws another warning and you can't see why.
How to use this page. Find your problem in the list below. Click it. The answer is the first thing on the page — no scrolling required. Every page has a "Short answer" box at the top, followed by the working code, then the explanation. If you're looking for a structured learning path instead, the React learning path covers every concept from scratch.
⚠️ Errors & warnings
The compiler messages and console warnings that stop you cold.
"Cannot update a component while rendering"
When calling setState inside render triggers a loop warning. The fix and the real cause.
"Each child in a list should have a unique key"
Why keys matter, when index keys break, and the pattern that scales.
"React Hook useEffect has a missing dependency"
The most confusing warning in React. What it means and how to fix it safely.
"Maximum update depth exceeded"
The infinite re-render loop. Three causes, three fixes.
"Cannot read property of undefined"
The most common React runtime crash — and how to guard against it.
🪝 Hooks
useState, useEffect, useRef, useMemo, useCallback, and the rules.
How to type useRef
DOM refs, mutable refs, nullability, and the initial value that matters.
How to clean up useEffect
Timers, subscriptions, fetch aborts — the cleanup function that prevents leaks.
useMemo vs useCallback
When to use each, why they're not interchangeable, and when neither helps.
How to write a custom hook
The rules, the naming, and the patterns every custom hook follows.
"Hooks can only be called inside the body of a function component"
The rules-of-hooks error. Where hooks can and can't be called.
🎛️ State & events
useState, useReducer, event handlers, controlled inputs.
"State is not updating"
Why setState doesn't change the current render and how to use functional updates.
How to make a controlled input
value + onChange, why the input warns about "value without onChange," and the fix.
useReducer vs useState
When one object of state isn't enough, and how to model transitions.
How to pass a function as a prop
Callbacks, arrow functions vs method references, and the "this" question.
How to update an array in state
Add, remove, edit items without mutating. The spread pattern for arrays.
🔷 React + TypeScript
Typing props, state, events, and refs. Pairs with the TypeScript track.
How to type children in React
ReactNode, ReactElement, JSX.Element — which one, and when.
How to type a form submit event
React.FormEvent
How to forward refs with TypeScript
forwardRef generics, displayName, and the React 19 ref-as-prop pattern.
How to type a generic component
The pattern behind TanStack Table, React Hook Form, and every typed data table.
How to type props
Interface vs type, optional props, children, and React.ComponentProps.
⚡ Performance
When to memoize, when to ignore it, and the trade-offs.
📋 All 20 problems
Sorted by category. Click any to jump straight to the answer.