Why subscribe doesn't work with zustand?
why when state gets update subscribe doesn't work?
I expect - when I change state.food - I got console log 202
I expect - when I change state.food - I got console log 202
const useCartStore = create(subscribeWithSelector(cartStore))
useCartStore.subscribe(
state => state.food,
food => {
console.log(202)
if (typeof window === "undefined") return
const storage = getStorage()
storage.saveFood(food)
},
)
export default useCartStore