I'm using a store for a modal and like to use the magic $watch method like so:
Alpine.store('modal', {
init() {
this.$watch('this.open', (val) => console.log(val))
// Here I like to do if(open) { document.body.classList.add('overflow-hidden') }
},
open: false,
id: null,
close() {
this.open = false
this.id = null
}
})
But I get TypeError: this.$watch is not a function