What are React hooks?
Hooks are functions that let you use state and other React features inside function components, without writing a class. They were added so function components could manage state, side effects, and context.
The most common ones: useState adds local state; useEffect runs side effects (data fetching, subscriptions) after render, controlled by a dependency array; useMemo and useCallback memoise a value or a function reference to avoid unnecessary recomputation or re-renders; useRef holds a mutable value or a DOM reference that persists across renders without triggering one; useContext reads context.
Two rules govern them: call hooks only at the top level (never in loops, conditions, or nested functions) so the call order is stable, and call them only from React functions. A good interview answer explains why those rules exist — React tracks hook state by call order — and gives a concrete example, such as useEffect with a cleanup function to unsubscribe on unmount.