~/alexsh.blog

$ cat react-internals/11-misconceptions.md

Misconceptions

February 9, 20261 min readpart 11/13

"Virtual DOM diffing is fast."

Not inherently. Diffing has cost. React's real win is batching DOM writes and avoiding layout-thrashing reads. Svelte and SolidJS skip the VDOM entirely and can outperform React for fine-grained updates.

"Re-renders mean DOM updates."

A re-render means React calls your component function and diffs the output. If nothing changed, no DOM mutations happen. Re-renders are computation, not necessarily DOM work.

"useCallback prevents re-renders."

useCallback stabilizes a function reference. It only prevents re-renders if the child is wrapped in React.memo. By itself, it does nothing.

"Context replaces state management."

Context is dependency injection, not a state manager. No selector mechanism — every consumer re-renders on any change. For high-frequency updates, use Zustand, Jotai, or Redux.

"key is just for lists."

You can use key on any component to force a full unmount/remount: \<Profile key=\{userId\} /\>. Changing the key resets all state and effects.

Further reading