React hook to subscribe to updates of a reactive variable.
Note: callback is always using current scope.
The reactive variable to subscribe to.
A callback function triggered whenever the reactive variable is updated. The first and second arguments are the new and the old value of this rv.
rv
const counter = rv(0)useRvEffect(counter, (newVal, oldVal) => { console.table({ newVal, oldVal })}) Copy
const counter = rv(0)useRvEffect(counter, (newVal, oldVal) => { console.table({ newVal, oldVal })})
React hook to subscribe to updates of a reactive variable.
Note: callback is always using current scope.