31
loading...
This website collects cookies to deliver better user experience
<template>
(HTML/JSX), <script>
(JS structured within intuitively named options), <style>
(CSS). useEffect
, useMemo
, useCallback
) and that it is impossible to understand what the second argument in the aforementioned hooks was for without referring to documentation. So while these hooks are more flexible and hence reusable than their Vue counterparts (watch
- useEffect
, computed
- useMemo
and useCallback
, mounted
- hooks with an empty second argument), they are also much less interpretable.methods
option in Vue. React Hook | Vue option |
---|---|
useState |
data |
useEffect(, [x]) |
watch |
useCallback(, [x]) |
computed |
useMemo(, [x]) |
computed |
useEffect(, []) , useCallback(, []) , useMemo(, [])
|
mounted |
return function called within useEffect(... return function(), [])
|
unmounted |
<style scoped>
segment.