{"id":17195,"date":"2025-05-27T13:14:36","date_gmt":"2025-05-27T04:14:36","guid":{"rendered":"https:\/\/www.ecomottblog.com\/?p=17195"},"modified":"2025-05-27T13:14:36","modified_gmt":"2025-05-27T04:14:36","slug":"storybook-msw-%e3%82%92%e5%ae%9f%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%ab%e5%b0%8e%e5%85%a5%e3%81%97%e3%81%a6%e3%82%8f%e3%81%8b%e3%81%a3%e3%81%9f%e3%80%8c%e5%9c%b0%e5%91%b3","status":"publish","type":"post","link":"https:\/\/www.ecomottblog.com\/?p=17195","title":{"rendered":"Storybook + MSW \u3092\u5b9f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u5c0e\u5165\u3057\u3066\u308f\u304b\u3063\u305f\u300c\u5730\u5473\u306b\u8a70\u307e\u308b\u300d\u30dd\u30a4\u30f3\u30c8\u96c6"},"content":{"rendered":"<p>\u304a\u75b2\u308c\u69d8\u3067\u3059\u3002SJC\u5171\u540c\u958b\u767a\u63a8\u9032\u5ba4\u306e\u5883\u7530\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u793e\u5185\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b <strong>Storybook<\/strong> \u3068 <strong>MSW\uff08Mock Service Workers\uff09<\/strong> \u3092\u5c0e\u5165\u3057\u305f\u969b\u306e\u624b\u9806\u3068\u3001\u906d\u9047\u3057\u305f\u30a8\u30e9\u30fc\u304a\u3088\u3073\u5bfe\u51e6\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u540c\u69d8\u306e\u69cb\u6210\uff08React 18, TypeScript, MUI, Vite \u306a\u3069\uff09\u3067\u958b\u767a\u3057\u3066\u3044\u308b\u65b9\u306e\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<hr \/>\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>React 18 \/ Vite \/ MUI \/ TypeScript \u30d9\u30fc\u30b9\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3066\u3001<strong>Storybook + MSW\uff08Mock Service Workers\uff09\u3092\u5c0e\u5165<\/strong>\u3057\u305f\u969b\u306e\u624b\u9806\u3068\u3001\u5b9f\u969b\u306b\u906d\u9047\u3057\u305f\u30c8\u30e9\u30d6\u30eb\u30fb\u843d\u3068\u3057\u7a74\u3092\u6574\u7406\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u5358\u7d14\u306b\u300c\u52d5\u304f Story \u3092\u4f5c\u308b\u300d\u3060\u3051\u3067\u306a\u304f\u3001<strong>\u65e2\u5b58\u30b7\u30b9\u30c6\u30e0\u306e\u69cb\u9020\u3084\u578b\u5236\u7d04\u3068\u306e\u6574\u5408\u3092\u53d6\u308b<\/strong>\u3046\u3048\u3067\u91cd\u8981\u3060\u3063\u305f\u30dd\u30a4\u30f3\u30c8\u3092\u5171\u6709\u3057\u307e\u3059\u3002<\/p>\n<hr \/>\n<h2>Storybook \u3068 MSW \u3068\u306f\uff1f<\/h2>\n<h3>Storybook \u3068\u306f\uff1f<\/h3>\n<p>Storybook \u306f\u3001React \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306a\u3069 UI \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092<strong>\u72ec\u7acb\u3057\u3066\u958b\u767a\u30fb\u691c\u8a3c\u30fb\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u5316<\/strong>\u3067\u304d\u308b\u958b\u767a\u652f\u63f4\u30c4\u30fc\u30eb\u3067\u3059\u3002\u30a2\u30d7\u30ea\u5168\u4f53\u3092\u7acb\u3061\u4e0a\u3052\u306a\u304f\u3066\u3082\u3001\u500b\u3005\u306e UI \u3092\u5358\u4f53\u3067\u8868\u793a\u30fb\u30c6\u30b9\u30c8\u3067\u304d\u308b\u306e\u304c\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u3067\u3059\u3002<\/p>\n<h3>MSW\uff08Mock Service Workers\uff09\u3068\u306f\uff1f<\/h3>\n<p>MSW \u306f\u3001<strong>API \u901a\u4fe1\u3092\u30e2\u30c3\u30af\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea<\/strong>\u3067\u3059\u3002Service Worker \u3092\u5229\u7528\u3057\u3066\u3001\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u5074\u304b\u3089\u306e HTTP \u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5bfe\u3057\u3066\u3001\u4efb\u610f\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u305b\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<strong>\u5b9f\u969b\u306e API \u3092\u4f7f\u308f\u305a\u306b\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092\u958b\u767a\u30fb\u691c\u8a3c\u3067\u304d\u308b<\/strong>\u70b9\u304c\u7279\u9577\u3067\u3059\u3002<\/p>\n<hr \/>\n<h2>\u306a\u305c\u5c0e\u5165\u3057\u305f\u306e\u304b\uff1f<\/h2>\n<p>\u4eca\u56de Storybook \u3068 MSW \u3092\u5c0e\u5165\u3057\u305f\u80cc\u666f\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n<ul>\n<li>\u958b\u767a\u4e2d\u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 API \u304c\u672a\u5b9f\u88c5\u3067\u3082\u3001UI \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u52d5\u4f5c\u78ba\u8a8d\u3084\u30ec\u30d3\u30e5\u30fc\u3092\u53ef\u80fd\u306b\u3057\u305f\u3044<\/li>\n<li>\u5b9f\u969b\u306e API \u4ed5\u69d8\u306b\u57fa\u3065\u3044\u305f\u30e2\u30c3\u30af\u3067\u3001UI \u306e\u6319\u52d5\u30fb\u72b6\u614b\u5909\u5316\u3092\u4e8b\u524d\u306b\u691c\u8a3c\u3057\u305f\u3044<\/li>\n<li>\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u30a8\u30f3\u30b8\u30cb\u30a2\u9593\u3067\u306e<strong>\u30c7\u30b6\u30a4\u30f3\u30ec\u30d3\u30e5\u30fc\u3084 QA \u306e\u52b9\u7387\u5316<\/strong>\u3092\u56f3\u308a\u305f\u3044<\/li>\n<\/ul>\n<p>Storybook + MSW \u3092\u4f7f\u3046\u3053\u3068\u3067\u3001API \u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u5236\u5fa1\u304c\u5bb9\u6613\u306b\u306a\u308a\u3001<strong>\u3055\u307e\u3056\u307e\u306a UI \u72b6\u614b\u3092\u518d\u73fe\u3057\u305f Story \u306e\u4f5c\u6210\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/strong><\/p>\n<hr \/>\n<h2>\u524d\u63d0\u74b0\u5883<\/h2>\n<ul>\n<li>React: 18.2.0<\/li>\n<li>TypeScript: 5.3.3<\/li>\n<li>Vite<\/li>\n<li>Material UI: @mui\/material\uff08v5\uff09<\/li>\n<li>TanStack Query<\/li>\n<li>Storybook 7.x<\/li>\n<li>WSL2 + Ubuntu\uff08VSCode Remote\uff09<\/li>\n<\/ul>\n<hr \/>\n<h2>Step 1: Storybook \u521d\u671f\u5316\u3068\u4f9d\u5b58\u30a8\u30e9\u30fc\u306e\u5bfe\u5fdc<\/h2>\n<pre><code class=\"bash\">npm create storybook@latest\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-092751.png\" alt=\"\" width=\"974\" height=\"801\" class=\"alignnone size-full wp-image-17410\" srcset=\"https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-092751.png 974w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-092751-300x247.png 300w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-092751-768x632.png 768w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-092751-260x214.png 260w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-092751-282x232.png 282w\" sizes=\"(max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>\u521d\u671f\u5316\u30b3\u30de\u30f3\u30c9\u3067\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b\u8a2d\u5b9a\u306b\u306f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3088\u3063\u3066<strong>\u4f9d\u5b58\u95a2\u4fc2\u306e\u885d\u7a81\u3084\u975e\u5bfe\u5fdc\u30a8\u30e9\u30fc<\/strong>\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u4e3b\u306a\u4f9d\u5b58\u95a2\u4fc2\u30c8\u30e9\u30d6\u30eb<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u30e9\u30a4\u30d6\u30e9\u30ea<\/th>\n<th>\u554f\u984c<\/th>\n<th>\u89e3\u6c7a\u7b56<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>@material-ui\/core@4.x<\/code><\/td>\n<td>React 18 \u306b\u975e\u5bfe\u5fdc<\/td>\n<td><code>@mui\/material<\/code>\uff08v5\uff09\u306b\u79fb\u884c<\/td>\n<\/tr>\n<tr>\n<td><code>@testing-library\/react-hooks<\/code><\/td>\n<td>React 18 \u306b\u975e\u5bfe\u5fdc<\/td>\n<td>\u524a\u9664\u3057 <code>@testing-library\/react<\/code> \u306b\u7d71\u5408<\/td>\n<\/tr>\n<tr>\n<td><code>react-apexcharts<\/code><\/td>\n<td><code>apexcharts<\/code> \u30d0\u30fc\u30b8\u30e7\u30f3\u4e0d\u4e00\u81f4<\/td>\n<td><code>apexcharts@^4.0.0<\/code> \u3092\u624b\u52d5\u6307\u5b9a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>Step 2: Storybook + MSW \u3092\u4f7f\u3063\u3066 API \u3092\u30e2\u30c3\u30af<\/h2>\n<p>\u4ee5\u4e0b\u306f\u3001<strong>Sample \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092 MSW \u3067\u30e2\u30c3\u30af\u3057\u305f Story \u306e\u4e00\u4f8b<\/strong>\u3067\u3059\u3002<\/p>\n<pre><code class=\"tsx\">\/\/ \u7701\u7565\u3057\u305f import \u7fa4\u3042\u308a\nconst queryClient = new QueryClient();\n\nconst meta: Meta&lt;typeof Sample&gt; = {\n  title: 'Components\/Sample',\n  component: Sample,\n  decorators: [\n    (Story) =&gt; (\n      &lt;MemoryRouter initialEntries={['\/sample\/123456']}&gt;\n        &lt;QueryClientProvider client={queryClient}&gt;\n          &lt;HeaderProvider&gt;\n            &lt;Story \/&gt;\n          &lt;\/HeaderProvider&gt;\n        &lt;\/QueryClientProvider&gt;\n      &lt;\/MemoryRouter&gt;\n    ),\n  ],\n};\n\nexport default meta;\n\nexport const Default: StoryObj&lt;typeof Sample&gt; = {\n  parameters: {\n    msw: {\n      handlers: [\n        http.get(BACKEND_BASE_URL + '\/sample\/:id', async ({ params }) =&gt; {\n          return HttpResponse.json({\n            id: params.id,\n            name: 'Mock Sample',\n          });\n        }),\n      ],\n    },\n  },\n};\n<\/code><\/pre>\n<p>\u8d77\u52d5\u7d50\u679c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346.png\" alt=\"\" width=\"1920\" height=\"898\" class=\"alignnone size-full wp-image-17412\" srcset=\"https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346.png 1920w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346-300x140.png 300w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346-1024x479.png 1024w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346-768x359.png 768w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346-1536x718.png 1536w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346-304x142.png 304w, https:\/\/www.ecomottblog.com\/wp-content\/uploads\/2025\/05\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-05-27-093346-282x132.png 282w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<hr \/>\n<h2>\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8\uff1a<strong>data \u3092\u8fd4\u3057\u3066\u306a\u3044\u306e\u306b <code>res.data.id<\/code> \u306b\u5024\u304c\u5165\u3063\u3066\u3044\u305f<\/strong><\/h2>\n<p>\u4e00\u898b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a JSON \u3092\u8fd4\u3057\u3066\u3044\u308b\u306f\u305a\u306e MSW \u30e2\u30c3\u30af\uff1a<\/p>\n<pre><code class=\"json\">{\n  \"id\": \"123456\",\n  \"name\": \"Mock Sample\"\n}\n<\/code><\/pre>\n<p>\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001\u30a2\u30d7\u30ea\u5074\u3067\u306f <code>res.data.id<\/code> \u3092\u53c2\u7167\u3057\u3066\u3044\u3066\u3001\u5024\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3068\u3044\u3046\u4e8b\u8c61\u306b\u906d\u9047\u3002<\/p>\n<h3>\u539f\u56e0\uff1afetcher \u5074\u3067 <code>.data<\/code> \u3092\u62bd\u51fa\u3057\u3066\u3044\u305f<\/h3>\n<p>\u5171\u901a fetcher \u306e\u5b9f\u88c5\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ed\u30b8\u30c3\u30af\u304c\u5165\u3063\u3066\u304a\u308a\u3001<strong>MSW \u5074\u3082 <code>data<\/code> \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u542b\u3080\u5fc5\u8981\u304c\u3042\u308b<\/strong>\u3053\u3068\u304c\u539f\u56e0\u3067\u3057\u305f\u3002<\/p>\n<pre><code class=\"ts\">\/\/ utils\/fetcher.ts\nexport const fetcher = &lt;T&gt;(url: string): Promise&lt;T&gt; =&gt;\n  fetch(url).then((res) =&gt; res.json()).then((json) =&gt; json.data);\n<\/code><\/pre>\n<p>\u672c\u756a API \u304c <code>data: {...}<\/code> \u3092\u8fd4\u3059\u4ed5\u69d8\u306b\u306a\u3063\u3066\u3044\u305f\u305f\u3081\u3001<strong>\u30e2\u30c3\u30af\u3067\u3082\u3053\u306e\u5f62\u5f0f\u306b\u5408\u308f\u305b\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f<\/strong>\u306e\u3067\u3059\u3002<\/p>\n<hr \/>\n<h2>\u89e3\u6c7a\u7b56\uff1aStorybook \u5c02\u7528\u306e fetcher \u3092\u5c0e\u5165<\/h2>\n<p>MSW \u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u672c\u756a\u306b\u5408\u308f\u305b\u3066 <code>data<\/code> \u3092\u542b\u3081\u308b\u306e\u3082\u4e00\u6848\u3067\u3059\u304c\u3001<strong>Storybook \u4e0a\u3060\u3051\u72ec\u81ea\u306e fetcher \u3092\u4f7f\u3046<\/strong>\u3053\u3068\u3067\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>mockFetcher \u306e\u5c0e\u5165\u4f8b<\/h3>\n<pre><code class=\"ts\">\/\/ storybook\/fetcher.ts\nexport const mockFetcher = &lt;T&gt;(url: string): Promise&lt;T&gt; =&gt;\n  fetch(url).then((res) =&gt; res.json()); \/\/ .data \u306e\u62bd\u51fa\u306a\u3057\n<\/code><\/pre>\n<h3>Provider \u3067\u306e\u5207\u308a\u66ff\u3048<\/h3>\n<pre><code class=\"tsx\">&lt;MyApiProvider value={{ fetcher: mockFetcher }}&gt;\n  &lt;Story \/&gt;\n&lt;\/MyApiProvider&gt;\n<\/code><\/pre>\n<h3>\u578b\u3068\u306e\u6574\u5408\u3092\u4fdd\u3064\u305f\u3081\u306e\u30d2\u30f3\u30c8<\/h3>\n<p>Storybook \u7528\u306e mockFetcher \u3092\u5c0e\u5165\u3059\u308b\u969b\u3001\u578b\u306e\u6574\u5408\u6027\u3092\u4fdd\u3064\u305f\u3081\u306b <code>ApiContext<\/code> \u306e\u578b\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8abf\u6574\u3057\u307e\u3057\u305f\uff1a<\/p>\n<pre><code class=\"ts\">type ApiContextType = {\n  fetcher: &lt;T&gt;(url: string) =&gt; Promise&lt;T&gt;;\n};\n\nexport const ApiContext = createContext&lt;ApiContextType | undefined&gt;(undefined);\n<\/code><\/pre>\n<hr \/>\n<h2>\u305d\u306e\u4ed6\u306e Tips<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u9805\u76ee<\/th>\n<th>\u5185\u5bb9<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>msw<\/code> \u304c\u52d5\u304b\u306a\u3044<\/td>\n<td><code>.storybook\/preview.ts<\/code> \u306b <code>initialize()<\/code> \u3068 <code>mswLoader<\/code> \u3092\u8a18\u8ff0\u3059\u308b\u5fc5\u8981\u3042\u308a<\/td>\n<\/tr>\n<tr>\n<td>\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u30a2\u30c9\u30aa\u30f3\u306e\u6df7\u5728<\/td>\n<td><code>@storybook\/addon-interactions<\/code> \u3068 <code>experimental-addon-test<\/code> \u306f\u5171\u5b58\u4e0d\u53ef<\/td>\n<\/tr>\n<tr>\n<td>\u30eb\u30fc\u30bf\u30fc\u304c\u5fc5\u8981\u306a Storybook<\/td>\n<td><code>MemoryRouter<\/code> \u3067 <code>initialEntries<\/code> \u3092\u660e\u793a<\/td>\n<\/tr>\n<tr>\n<td>TanStack Query \u304c\u518d\u5229\u7528\u3067\u304d\u306a\u3044<\/td>\n<td><code>QueryClient<\/code> \u3092 Storybook \u7528\u306b\u5225\u7ba1\u7406\u3057\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5207\u308b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u307e\u3068\u3081<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u30c8\u30d4\u30c3\u30af<\/th>\n<th>\u5b66\u3073\u30fb\u5bfe\u5fdc\u65b9\u6cd5<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Storybook \u5c0e\u5165\u6642\u306e\u4f9d\u5b58\u30a8\u30e9\u30fc<\/td>\n<td>MUI v5 \u3078\u306e\u79fb\u884c\u3001react-hooks \u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u524a\u9664<\/td>\n<\/tr>\n<tr>\n<td>MSW \u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u69cb\u9020\u3068\u30a2\u30d7\u30ea\u306e\u671f\u5f85\u306e\u4e0d\u4e00\u81f4<\/td>\n<td>fetcher \u306e\u4ed5\u69d8\u306b\u5408\u308f\u305b\u3066 <code>data<\/code> \u30e9\u30c3\u30d7\u3092\u8ffd\u52a0 or Storybook \u5c02\u7528 fetcher \u3092\u5c0e\u5165<\/td>\n<\/tr>\n<tr>\n<td>\u578b\u306e\u5236\u7d04\u3067 <code>data<\/code> \u3092\u4f7f\u3048\u306a\u3044\u5834\u5408<\/td>\n<td>mockFetcher \u5074\u3067\u578b\u306e\u8abf\u6574\u30fbcontext \u7d4c\u7531\u3067\u5207\u308a\u66ff\u3048<\/td>\n<\/tr>\n<tr>\n<td>Storybook \u30a2\u30c9\u30aa\u30f3\u7af6\u5408<\/td>\n<td>\u5b89\u5b9a\u7248\u306e <code>@storybook\/addon-interactions<\/code> \u306e\u307f\u63a1\u7528<\/td>\n<\/tr>\n<tr>\n<td>WSL<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u6a29\u9650\u30a8\u30e9\u30fc<\/td>\n<td><code>chown -R $(whoami):$(whoami)<\/code> \u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u6240\u6709\u8005\u3092\u5909\u66f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Storybook \u306e\u5c0e\u5165\u306f\u898b\u305f\u76ee\u4e0a\u306f\u30b9\u30e0\u30fc\u30ba\u3067\u3059\u304c\u3001<strong>\u65e2\u5b58\u306e fetcher \u3084\u578b\u5b9a\u7fa9\u3068\u6574\u5408\u6027\u3092\u53d6\u308b\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059<\/strong>\u3002<br \/>\n\u307e\u305f\u3001MSW \u306f\u305f\u3060\u306e\u300c\u4eee\u30c7\u30fc\u30bf\u751f\u6210\u300d\u3067\u306f\u306a\u304f\u3001<strong>\u5b9f API \u3068\u69cb\u9020\u3092\u63c3\u3048\u308b\u3053\u3068\u3067\u3001\u5b89\u5fc3\u30fb\u78ba\u5b9f\u306a UI \u691c\u8a3c\u74b0\u5883<\/strong>\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u5f8c\u3001Storybook \u3084 MSW \u3092\u5c0e\u5165\u3059\u308b\u65b9\u306e\u4e00\u52a9\u3068\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\uff01<\/p>\n<p>\u6700\u5f8c\u307e\u3067\u95b2\u89a7\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u30a8\u30b3\u30e2\u30c3\u30c8\u3067\u306f\u3001\u3068\u3082\u306b\u672a\u6765\u306e\u5e38\u8b58\u3092\u5275\u308b\u4ef2\u9593\u3092\u52df\u96c6\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u5f0a\u793e\u306b\u5c11\u3057\u3067\u3082\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u305c\u3072\u4e0b\u8a18\u306e\u63a1\u7528\u30da\u30fc\u30b8\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\uff01<\/p>\n<p>&nbsp;<\/p>\n<div style=\"margin-bottom: 32px; text-align: center;\"><a style=\"border: solid 1px #1ABB9A; padding: 16px 72px;\" href=\"https:\/\/www.ecomott.co.jp\/recruit\/\" target=\"_blank\" rel=\"noopener\">\u52df\u96c6\u8981\u9805<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u304a\u75b2\u308c\u69d8\u3067\u3059\u3002SJC\u5171\u540c\u958b\u767a\u63a8\u9032\u5ba4\u306e\u5883\u7530\u3067\u3059\u3002 \u4eca\u56de\u306f\u793e\u5185\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b Storybook \u3068 MSW\uff08Mock Service Workers\uff09 \u3092\u5c0e\u5165\u3057\u305f\u969b\u306e\u624b\u9806\u3068\u3001\u906d\u9047\u3057\u305f\u30a8\u30e9\u30fc\u304a\u3088\u3073\u5bfe\u51e6\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u540c\u69d8\u306e [&hellip;]<\/p>\n","protected":false},"author":120,"featured_media":17324,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/17195"}],"collection":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/users\/120"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17195"}],"version-history":[{"count":18,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/17195\/revisions"}],"predecessor-version":[{"id":17415,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/posts\/17195\/revisions\/17415"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=\/wp\/v2\/media\/17324"}],"wp:attachment":[{"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecomottblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}