When setting up a store, I initially use:
document.addEventListener('alpine:init', () => {
Alpine.store('selectedInput', 0)
})
However, when attempting to update selectedInput
within a function later on, it doesn't reflect the change:
function example() {
Alpine.store('selectedInput', 3)
}