๐
Storybook with CRA and TS
Table of contents
CRA๋ก TypeScript ํ ํ๋ฆฟ์ ์ฌ์ฉํ์ฌ ๋น๋
bash
$ yarn create react-app storybook --template typescript
bash
$ cd storybook
Storybook์ ์ค์นํ๋ฉด์ ts ํฌ๋ฉง์ผ๋ก ์ด๊ธฐํ
bash
$ npx -p @storybook/cli sb init --story-format=csf-ts
.storybook/main.js
๋ฅผ ๋ฐ๋ก ์์ ํ ํ์์์ด ํ๋ฒ์ ์ด๊ธฐํ ํด์ค๋ค.
src/stories
ํ์์ ํ์ผ๋ค๋ .tsx
๋ก ์์ฑํด์ค๋ค.
์๋์จ ์ค์น
bash
$ yarn add -D @storybook/addon-info react-docgen-typescript-loader
styled-components ์ค์น
bash
$ yarn add styled-components @types/styled-components
Reference
Storybook Docs Typescript Walkthrough
Storybook์ ์ด์ฉํ React Test ํ๊ฒฝ ๊ตฌ์ถํ๊ธฐ | by Woohyun Jang | Medium
strothj/react-docgen-typescript-loader
jbee.io/tool/stor...ook-intro/