Zustand question

const useStore = create((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
  decrement: () => set((state) => ({ count: state.count - 1 })),
}));

i know that we should get count by
useStore((state)=>state.count)
right? But what about increment and decrement function, cant i just use
useStore.getState.increment
? It is not like the inrement function re-render is needed for reactivity, there is nothing that depends on it?
Solution
okay i am dumb, should have read docs better
Was this page helpful?