Skip to content
Created: August 25, 2025

Vue3 → React comparison study table (must know the core) ​

1. Core mental model comparison (the most important ⭐⭐⭐) ​

DimensionsVue 3React 18
Frame PositioningProgressive FrameworkUI Library
Core ideaReactive dependency collectionState-driven re-execution
update triggersetter → triggersetState → rerender
CompilerStrong (SFC + templates)Weak (JSX straight out)
diff granularitystatic boost / PatchFlagsFiber + Scheduler
Recommended paradigmDeclarative templatesFunctions are UI
Design philosophyMinimize rerendersRerenders are the norm

Key changes:

  • Vue: "If the data changes, whoever uses it will update it"
  • React: "The state has changed, and the component function is re-run"

2. Responsive system vs Hooks (⭐⭐⭐) ​

1️⃣ state ​

Vue3React
ref()useState()
reactive()useState(object)
.valuedirect variable
ts
// Vue
const count = ref(0)
count.value++

// React
const [count, setCount] = useState(0)
setCount(c => c + 1)

⚠️ React state is immutable thinking

ts
// ❌ 错误
state.count++

// ✅ 正确
setState(prev => ({ ...prev, count: prev.count + 1 }))

2️⃣ computed ​

Vue3React
computed()useMemo()
ts
// Vue
const total = computed(() => a.value + b.value)

// React
const total = useMemo(() => a + b, [a, b])

🧠 Essential differences:

  • Vue: automatic dependency collection
  • React: manual dependency array

3️⃣ watch / watchEffect ​

Vue3React
watch()useEffect()
watchEffect()useEffect()
ts
useEffect(() => {
  console.log(count)
}, [count])

⚠️ React’s useEffect = life cycle + side effects

  • Not watch
  • No guarantee of synchronization

3. Life cycle comparison (⭐⭐) ​

Vue3React
onMounteduseEffect(() => {}, [])
onUpdateduseEffect(() => {})
onUnmountedreturn cleanup
nextTickuseLayoutEffect / flushSync

4. Component communication (⭐⭐⭐) ​

1️⃣ father → son ​

VueReact
propsprops
jsx
<Child count={count} />

2️⃣ son → father ​

VueReact
$emitprops callback
jsx
<Child onChange={setCount} />

3️⃣ slots vs children ​

VueReact
<slot />{props.children}
named slotrender props

5. v-if / v-for / command comparison (⭐⭐) ​

Vue DirectivesReact
v-ifcondition && <Comp />
v-forarray.map()
v-modelControlled components
v-bind{...props}
v-ononClick

6. Template vs JSX (core thinking difference ⭐⭐⭐) ​

Vue ​

vue
<div>{{ count }}</div>

React ​

jsx
<div>{count}</div>

🧠 React JSX essence:

JS expression + function call

7. ref & DOM operations (⭐⭐) ​

Vue3React
ref="el"useRef()
jsx
const el = useRef(null)

useEffect(() => {
  el.current.focus()
}, [])

8. Status management comparison (⭐⭐) ​

VueReact
PiniaRedux Toolkit
provide/injectContext
VuexRedux (old)

9. Performance optimization ideas (⭐⭐⭐) ​

Vue3React
Automatic dependency trackingManual memo
v-memomemo()
Static promotionuseMemo / useCallback

10. Where you need to be “counter-intuitive” (must read ⚠️) ​

❗ In React: ​

  1. rerender is not equal to DOM update
  2. The function will be re-executed every time
  3. Closures are a performance & bug source
  4. The dependent array must be written in full