ref and reactive options
See original GitHub issueHey,
I noticed that if you have values which are already a ref
the options parameter doesn’t recognise a change on those values. Is there a proper way to get around this?
Example
// enabled is externally changed
const enabled = ref(false);
const options = reactive({ enabled: enabled.value });
// if enabled is changed to true, the query does not fire
const q = useQuery('query', myFunction, options)
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Vue 3 Composition API: Ref vs Reactive - Dan Vega
ref() takes an inner value and returns a reactive and mutable ref object. The ref object has a single property .value that points...
Read more >Ref() vs Reactive() in Vue 3 — what's the right choice? - Medium
ref() can take as arguments primitives (most common: Boolean , String and Number ) as well as Objects, while reactive() can only take...
Read more >ref vs reactive in Vue 3? - Stack Overflow
Typically, ref and reactive both have been used to create reactive objects where ref is used to make the primitive values to be...
Read more >Reactivity API: Core - Vue.js
If an object is assigned as a ref's value, the object is made deeply reactive with reactive(). This also means if the object...
Read more >Vue 3 Composition API: ref() vs. reactive() - Markus Oberlehner
Let's start with the basics: you must use ref() to create a reactive primitive value. // Boolean ref const isVisible = ref(true); ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmm in this case something like this should work for you:
or
Your example works because the reactive you check does not rely on any refs, however, for my case, I need to rely on a computed ref. (In reference to onkarj)