How to keep 'enabled' prop reactive when a Ref is passed
My code:
If I just pass
!!input.value
it isn't reactive, and if I pass !!input
it's always true. How do I avoid triggering a fetch when the input is an empty string?5 Replies
sensitive-blue•3y ago
I use a computed ref for this, so something like
enabled: computed(() => !!input.value)
xenial-blackOP•2y ago
I ended up doing that, something's just so disgusting to me with making a ref (computed) of a ref
sensitive-blue•2y ago
I agree. I love Vue, but some of the reactivity is a little wonky sometimes
xenial-blackOP•2y ago
I loved vue2 so much, then landed a job with react/next, then the current one with vue3. I gotta say I hate vue3 reactivity as much as I hated react syntax.
sensitive-blue•2y ago
Composition API and React hooks API both have their trade offs for sure