React Cheat Sheet 2026
The 30 highest-yield React facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
50 questions
60 min time limit
70% to pass
- What happens if you omit the dependency array entirely in useEffect? → It runs after every render
- What is an Error Boundary in React? → A component that catches JavaScript errors in its child tree and renders a fallback
- What problem does the useRef hook commonly solve? → Holding a mutable value that persists without causing re-renders
- What does React.memo do to a functional component? → Skips re-rendering if props are unchanged
- What does the `defaultValue` prop do on a React input element? → Sets the initial value without making the input controlled
- What should a data-fetching useEffect return to avoid memory leaks? → A cleanup function
- What is a portal in React (ReactDOM.createPortal)? → A way to render children into a DOM node outside the parent hierarchy
- Which of the following is a valid useEffect cleanup? → useEffect(() => { return () => clearInterval(id); })
- What does the useTransition hook provide? → A way to mark state updates as non-urgent transitions
- Which built-in hook pair is most commonly combined in a useFetch custom hook? → useState and useEffect
- What does an Error Boundary catch? → Errors thrown during rendering of child components
- What does React.lazy enable? → Code-splitting by loading a component dynamically
- In which phase does useEffect run relative to the browser paint? → After the browser has painted
- What does useReducer's dispatch function do? → Sends an action to the reducer to compute the next state
- What is the purpose of the key prop when rendering a list? → Help React identify which items changed, added, or removed
- Can you use Hooks inside a class component? → No, Hooks only work in function components
- What does a custom hook typically return? → It can return anything: values, functions, arrays, objects, or nothing
- Why is over-using useMemo considered an anti-pattern? → Memoization itself has overhead; the benefit only justifies complex computations
- What does React not include? → All of the above
- What does the useState hook return? → An array with the state value and a setter function
- What problem do React Hooks primarily solve? → They let function components use state and lifecycle features
- What is a useLocalStorage custom hook typically used for? → Persisting state to localStorage and syncing it with component state
- Why might you wrap a callback in useCallback before passing it to a memoized child? → To keep a stable reference so the child doesn't re-render unnecessarily
- Why should you never mutate state arrays directly with push() in React? → React won't detect the change and may not re-render
- How does a useEffect clean up after itself? → By returning a cleanup function
- After editing a component, how does Vite reflect changes in the browser without a full reload? → Hot Module Replacement (HMR)
- What does the useContext hook return? → The nearest Provider's value prop
- What is a custom Hook? → A JavaScript function whose name starts with 'use' and that may call other Hooks
- What is a React fragment? → A wrapper (<> or ) that groups multiple elements without adding extra DOM nodes
- Which hook lets you perform side effects in a function component? → useEffect
Turn these facts into recall: