I want to use 1 composable from within another. My first composable is basically a super lightweight version of Vuex:
import {
reactive,
readonly,
} from 'vue';
const state = reactive({
settings: {
loading: true,
},
cart: {
loading: true,
items: [],
},
});
export default {
state: readonly(state),
};
When I try to use this in another composable, the cart is not being reactive.
In my other composable I have:
import store from '@/store';
watch(store.state.cart, () => {
console.log('test');
});
And it doesn't seem to react to anything. When I try calling .value on it, its undefined, as if it's not a proxy.
I also tried using inject('store') and that seems to do the same thing.
I want to watch when any part of the cart changes.