Skip to content

React Knowledge Base ​

This set of docs is a React migration map for developers who already know Vue. It doesn't teach programming from zero — it answers one question: what do the Vue skills you have correspond to in React, where does the "feel" differ completely, and which pitfalls nearly every Vue-to-React convert has stepped in. The content is split into topic sub-pages; read them in the order below.

Set the mental model first: rewire your brain, then learn the APIs ​

Vue and React are both "componentized + virtual DOM", but their underlying philosophies are opposite. Grab this table — every sub-page below is an expansion of it:

DimensionVue 3React
Core mechanismReactivity system: ref/reactive track dependencies automatically; when data changes the view updates itselfRe-rendering: when state changes, the whole component function runs again, producing new JSX for diff
Template / logicTemplate is a DSL; the compiler does static hoisting and dependency collection — lots of "magic"JSX is just JS, no magic — whatever code you can write, you can render
Update granularityCompiler precisely marks which nodes are affectedComponent-level re-render of the whole subtree by default; you control performance optimization manually (the memo family)
Data flowTwo-way binding v-model is standard syntaxOne-way data flow; "two-way" is something you assemble from value + onChange
State mutabilityMutate directly: state.count++No in-place mutation: every state update must swap in a new object (immutable data)
OrganizationSplit by "feature option" (template / script / style)Everything is functions and call order (hooks)

In one line: Vue makes 80% of the decisions for you; React hands the choices (and the responsibility) back to you. Early on you'll feel "why do I have to do everything myself" — what you get in return is extreme flexibility and predictability.

Sub-page navigation ​

#TopicWhat you'll learn
1JSX & Template Syntaxtranslate v-if/v-for/{{}}/@click/v-model/<slot> into JSX one by one; three JSX detail traps
2Components & Statefunction components, props, useState, the immutable-data law, no nextTick, controlled forms
3Hooks in DepthuseEffect/useRef/useMemo/useCallback/custom hooks; dependency array & the closure trap
4Component Communicationprops/callbacks, children instead of slots, Context vs provide/inject, lifting state
5RoutingReact Router v6 in full, mapped item-by-item to vue-router; how to write guards
6State Managementchoosing Zustand/Redux Toolkit/Jotai/MobX; hand server data to React Query
7Performance & Common Pitfallsthe re-render model, how the memo trio works together, a 13-item Vue→React pitfall list, debugging tools

Suggested path: 1 → 2 → 3 are the foundation (especially the "immutable data" and "dependency array" items — the two places React and Vue diverge most), read them first; consult 4–6 as needed; come back to 7 whenever something weird happens.

Quick-reference table ​

ConceptVue 3React
Component definitionSFC + <script setup>function + JSX
Local stateref / reactiveuseState (immutable updates)
Computed / derivedcomputedcompute inline / useMemo
Watcherswatch / watchEffectuseEffect(fn, deps)
Lifecyclethe full onMounted familymostly useEffect dominating alone
DOM referencetemplate refuseRef + ref attribute
Style isolation<style scoped>CSS Modules / CSS-in-JS
Slots<slot> / #namechildren / JSX props / render prop
Cross-level commsprovide / injectContext (mind the re-render scope)
Routingvue-router (instance + guards)React Router (component + wrapper guards)
Global statePiniaZustand / Redux Toolkit (+ React Query for server data)
Transitions<Transition> / <KeepAlive>third-party: framer-motion, etc.
Build toolViteVite (recommended for CSR) / Next.js (SSR/RSC)
Meta-frameworkNuxtNext.js
DebuggingVue DevToolsReact DevTools

Learning resources ​

  • react.dev: the official new docs; the "Thinking in React" section specifically cures Vue muscle-memory conflicts — strongly recommended as your first read.
  • React Router: official routing docs.
  • Zustand: the simplest store, up to speed in ten minutes.
  • TanStack Query: the de facto standard for server state (the Vue twin exists — you may already have used it in Vue).
  • Hooks FAQ: official explanations of the closure trap and other tricky issues.