import create from 'zustand' const useStore = create((set) => ({ count: 0, increment: () => set((state) => ({ count: state.count + 1 })), decrement: () => set((state) => ({ count: state.count - 1 })), reset: () => set({ count: 0 }) })) export default useStore
хм, а стоило ли избавляться от:
export class Counter { count = 0 increment() { this.count ++ } decrement() { this.count -- } reset() { this.count = 0 } }