vue-reactivity-watch
v0.1.8
Published
<p align='center'> <img src='https://github.com/vue-reactivity/art/blob/master/svg/package-watch.svg?raw=true' height='250'> </p>
Downloads
81
Readme
Install
Usage
Note: since there is no Vue instance to be bond,
watchwill NOT be auto disposed. You need to always explicitly call the returning function to stop it. Or you can try @vue-reactivity/scope which will auto collect the effects for you.
Just like what you do in Vue.
import { ref, reactive, computed } from '@vue/reactivity'
import { watch, watchEffect } from '@vue-reactivity/watch'
const count = ref(1)
const stopWatch = watch(
count,
(newValue) => {
console.log(`Count: ${newValue}`)
}
)
count.value += 1
// Count: 2
stopWatch()License
MIT
