반응형
SMALL
storybook + CRA
-
Storybook 데이터 연결하기프론트엔드 2023. 4. 19. 19:30
이전 포스트까지 독립된 환경에서 상태를 가지지 않는 컴포넌트를 작성해보았습니다. 이번 포스트에서는 실제 데이터를 연결한 컴포넌트에 대한 Story 작성을 살펴보도록 하겠습니다. 1. Redux 설치 및 적용 redux를 이용해 전역상태를 정의해주겠습니다. redux 관련 패키지 설치 npm install @reduxjs/toolkit react-redux src/redux/tasks.ts 작성 interface StateType { tasks: TaskType[]; status: string; error: any; } interface ActionType { id: string; newTaskState: string; } const initialState: StateType = { tasks: [], s..