Zustand 시작하기


Zustand 시작하기

1. 설치 npm install zustand # or yarn add zustand 2. store 생성 import { create } from 'zustand' const useBearStore = create((set) => ({ bears: 0, increasePopulation: () => set((state) => ({ bears: state.bears + 1 })), removeAllBears: () => set({ bears: 0 }), })) 3. 컴포넌트에서 사용 const bears = useBearStore((state) => state.bears)...

Zustand 시작하기에 대한 요약내용입니다.

자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.


#React #typeScript #zustand #상태관리 #타입스크립트

원문링크 : Zustand 시작하기