The Useless UseCallback
Memoization, dependencies, and “useless useCallback”
- Big focus on how
useCallback/useMemoand dependency arrays leak implementation details across component boundaries. - Several argue: if a callback uses props, those props must be in the dependency array or you risk stale closures; omitting them is usually a bug.
- Counterpoint: a component whose behavior depends on its consumers passing referentially stable props has a fragile API; callers can’t know they must memoize unless they read internal implementation.
- Debate on whether “always memoize non-primitives” is a reasonable convention vs. unrealistic discipline, given third‑party libraries and large trees.
- Some devs memoize “everything” and report no performance regressions; others see memoization as brittle, hard to get right, and not worth the complexity except in clear hotspots.
- React Compiler is repeatedly mentioned as the place where “memo all the things” actually makes sense, because a compiler can do it consistently.
useEffect, exhaustive deps, and refs
- The
react-hooks/exhaustive-depsrule frustrates people: they “just want to run when X changes”, but are forced to include Y, causing effects to fire every render unless Y is memoized. - This pushes patterns like
useRef+useEffector custom hooks to get “latest value” semantics, which some see as elegant, others as spaghetti. - Complaints about race‑y state updates (multiple async updates, needing functional
setState, then wanting to run logic on the derived value) often end in awkwarduseEffectchains or ref-based workarounds. - Some argue most uses of
useEffectare a smell; effects should be only for syncing with external systems, not for internal data flow.
Hooks complexity and ergonomics
- Many feel hooks turned React from intuitive to “insidiously complex,” with fragile towers of
useEffect/useMemo/useCallback. - Others maintain hooks are powerful but require FP-style thinking and strict separation of view vs. business logic; misuse, not the model, is blamed.
- Suggested practice: keep components small and presentational, push logic into custom hooks, and minimize direct use of primitive hooks in component bodies—though some consider this over-abstraction.
Alternatives and broader trajectory
- Mentions of Vue, Svelte, Lit, Elm, signals, and global state libraries as offering more explicit or compiler-driven reactivity, often with less need for manual memoization.
- Mixed experiences: some find these simpler; others report different classes of subtle bugs.
- Overall sentiment from several long-time users: React has grown more complex without feeling proportionally more powerful, with newer features and SSR focus seen as bandaids rather than simplifications.