markRaw — makes object non-reactive. toRaw — returns raw object.
markRaw:
1import { reactive, markRaw } from "vue"23const raw = markRaw({ count: 0 })4const state = reactive({ data: raw })56state.data.count++ // NOT reactive
toRaw:
1import { reactive, toRaw } from "vue"23const state = reactive({ count: 0 })4const raw = toRaw(state)56raw.count++ // Does NOT trigger reactivity7state.count++ // Triggers reactivity
Key differences: