Zustand 사용기
·
프로젝트/학수고대 프로젝트
Zustand를 사용하는 이유 프로젝트에서 닉네임을 보내주는 api 로직이 하나인데, 닉네임을 다른 컴포넌트에서도 띄워야 했다. 그렇기에 해당 값을 전역적으로 관리할 필요를 느꼈고, 이에 따라 상태관리 라이브러리를 도입하게 됐다. 상태관리 라이브러리를 처음 사용해보는 만큼, 간단하고 빠르게 사용할 수 있다는 Zustand로 결정하게 되었다. https://zustand-demo.pmnd.rs/ Zustand zustand-demo.pmnd.rs 주스탠드 공식문서를 참고했다. 사용법 npm install zustand Zustand를 설치해 준다. import { create } from 'zustand' const useStore = create((set) => ({ count: 1, inc: () =>..