Zustand란?
const useStore = create((set) => ({
count: 0,
inc: () => set((s) => ({count: s.count+1}))
}));
const count = useStore((s) => s.count);장점
- Provider 래퍼 불필요
- Redux 대비 코드 1/5
- TypeScript 친화
미니멀 React 상태 관리 라이브러리. Redux의 복잡함 없이 훅 하나로.
const useStore = create((set) => ({
count: 0,
inc: () => set((s) => ({count: s.count+1}))
}));
const count = useStore((s) => s.count);