Vue 3 effect timing API | React equivalent |
---|---|
setup |
None |
onMounted |
useEffect with an empty dependency list |
onUpdated |
useEffect |
onUnmounted |
Callback returned from useEffect with an empty dependency list |
onBeforeMount |
None |
onBeforeUpdate |
Render function, sort of |
onBeforeUnmount |
None |
onErrorCaptured |
None |
onRenderTracked |
None |
onRenderTriggered |
None |
onActivated |
None |
onDeactivated |
None |
onServerPrefetch |
None |
watch with flush set to sync |
None |
watch with flush set to pre |
None |
watch with flush set to post |
useLayoutEffect |
React effect timing API | Vue 3 equivalent |
---|---|
useEffect with a list of reactive dependencies |
Technically none, but you can typically use watch with flush set to pre to achieve the same goals with less risk of infinite render loops |