I've been trying to pass down a value via a parent component to a child component without using props. I'm using provide for this on a parent component (not the highest parent). The value im passing down will be dynamically updated, so after reading the vue docs I have to do something like: Vue.computed(() => this.todos.length)
but it throws an error because Vue is undefined. I seem to be unable to import Vue like this import Vue from 'vue'
(or something similar). How can I make this work? To be honest, even when I try to pass down a static variable I get undefined in the (direct) child component, even when I use the exact same code as in the vue docs.
So I have 2 questions:
- how to refer/import the Vue instance?
- Is it possible to use provide on a direct parent component (which is not the root)?
I'm using Vue3