/
๐Ÿ“š

Storybook with CRA and TS

StorybookCRA
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

TypeScript Config

Storybook์„ ์ด์šฉํ•œ React Test ํ™˜๊ฒฝ ๊ตฌ์ถ•ํ•˜๊ธฐ | by Woohyun Jang | Medium

strothj/react-docgen-typescript-loader


jbee.io/tool/stor...ook-intro/

prev.kr/posts/sty...-on-react/

styled-components.com/docs/api

logo
Things I've Learned