DEV Community

Discussion on: The Quest for ReactiveScript

yyx990803 profile image
Evan You

FWIW, the Vue example is a bit misleading: you don't need $$() for common reactive effects if using watchEffect:

let value = $ref(0)

// log the value now and whenever it changes
watchEffect(() => console.log(value));

value = 10; // set a new value
Enter fullscreen mode Exit fullscreen mode

$$() is only needed if you have external composition functions that explicitly expect a raw ref object as arguments.

ryansolid profile image
Ryan Carniato Author • Edited on

Ok. Thanks Evan. I have updated that section to better represent common patterns in Vue. Thank you.

For what it's worth, without completely messing with the semantics I think the Function decoration approach like found in Vue Ref Sugar is the only approach that actually checks all the boxes. But I'm interested in what happens if we do just mess with everything.