{"id":14553,"date":"2021-09-24T15:28:24","date_gmt":"2021-09-24T06:28:24","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=14553"},"modified":"2023-05-27T18:31:56","modified_gmt":"2023-05-27T09:31:56","slug":"%e3%80%90ddd%e3%80%91%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%82%a8%e3%83%b3%e3%83%89-%e3%81%ab%e3%80%8c%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%a2%e3%83%bc%e3%82%ad%e3%83%86%e3%82%af%e3%83%81","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=14553","title":{"rendered":"\u3010DDD\u3011\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9 \u306b\u300c\u30af\u30ea\u30fc\u30f3\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u300d\u3092\u9069\u7528\u3057\u305f\u5834\u5408\u3001Redux\u306e\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>\u3082\u3057\u9069\u7528\u3059\u308b\u306a\u3089\u306e\u8a71\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u3042\u307e\u308a\u9069\u7528\u3055\u308c\u3066\u3044\u308b\u6848\u4ef6\u306f\u898b\u305f\u3053\u3068\u306a\u3044\u3067\u3059\u304c\u3002\uff09<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-14560\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2021\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2021-09-24-16.02.09-300x289.png\" alt=\"\" width=\"300\" height=\"289\" srcset=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2021\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2021-09-24-16.02.09-300x289.png 300w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2021\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2021-09-24-16.02.09.png 750w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h2>\u30d3\u30e5\u30fc\u30e2\u30c7\u30eb<\/h2>\n<p>\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3092\u8868\u793a\u306e\u305f\u3081\u306b\u5909\u63db\u3057\u305f\u3082\u306e\u3067\u3059\u3002SPA\u306e\u4e2d\u5fc3\u306b\u306f\u3053\u308c\u304c\u5c5e\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h2>\n<p>\u30d3\u30e5\u30fc\u30e2\u30c7\u30eb\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3057\u306a\u304c\u3089\u8868\u793a\u306b\u5fc5\u8981\u306a\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30a4\u30f3\u30d5\u30e9\u5c64<\/h2>\n<p>\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9 \u3067\u306f\u3001React\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08Web\u30d6\u30e9\u30a6\u30b6\uff09\u3084\u3001\u30ed\u30fc\u30ab\u30eb\u30b9\u30c8\u30ec\u30fc\u30b8\u306a\u3069\u304c\u8a72\u5f53\u3057\u307e\u3059\u3002<\/p>\n<h2>\u5b9f\u88c5\u4f8b<\/h2>\n<ul>\n<li>\u30da\u30fc\u30b8\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306bUseCase\u3092\u5305\u542b\u3059\u308b\u3002<\/li>\n<li>DI\u306e\u305f\u3081\u306bInversifyJS\u3092\u5229\u7528\u3059\u308b\u3002<\/li>\n<\/ul>\n<h3>application<\/h3>\n<h4>service<\/h4>\n<p>API\u306b\u9023\u643a\u3059\u308b\u305f\u3081\u306e\u51e6\u7406\u306a\u3069\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<h4>model<\/h4>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u4f7f\u3044\u3084\u3059\u3044\u5f62\u306e\u30e2\u30c7\u30eb<\/p>\n<h3>domain<\/h3>\n<h4>Repository<\/h4>\n<p>\u30ed\u30fc\u30ab\u30eb\u30b9\u30c8\u30ec\u30fc\u30b8\u3068\u304b\u306e\u62bd\u8c61\u30af\u30e9\u30b9\u3092\u5b9a\u7fa9\u3059\u308b\u3002<\/p>\n<h4>Entitiy<\/h4>\n<p>API\u3067\u304f\u308b\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3<\/p>\n<h3>interface<\/h3>\n<p>\u30af\u30ea\u30fc\u30f3\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306e\u5916\u5074\u3068\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<h4>adapters<\/h4>\n<p>\u5916\u5074\u3078\u306e\u30ad\u30fc\u3002(API\u306e\u30db\u30b9\u30c8\u3084\u3001URL\u3001\u30ed\u30fc\u30ab\u30eb\u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u30ad\u30fc\u306a\u3069\uff09<\/p>\n<h4>serviceImplements<\/h4>\n<p>\u30b5\u30fc\u30d3\u30b9\u306e\u5b9f\u4f53\u3092\u5b9a\u7fa9\u3059\u308b\u3002\u5b9f\u969b\u306b\u3001adapter\u3092\u4f7f\u3063\u3066\u5916\u5074\u3078\u901a\u4fe1\u3059\u308b\u3002<\/p>\n<h4>repositoryImplements<\/h4>\n<p>\u30ec\u30dd\u30b8\u30c8\u30ea\u306e\u5b9f\u4f53\u3092\u5b9a\u7fa9\u3059\u308b\u3002\u5b9f\u969b\u306b\u3001adapter\u3092\u4f7f\u3063\u3066\u5916\u5074\u3078\u901a\u4fe1\u3059\u308b\u3002<\/p>\n<h2>Redux\u5074<\/h2>\n<h3>\u57fa\u672c\u7684\u306a\u8003\u3048\u65b9<\/h3>\n<ul>\n<li>\u968e\u5c64\u304c\u5897\u3048\u308b\u3068\u76f8\u5bfe\u30d1\u30b9\u3092\u4f7f\u3063\u305fimport\u304c\u8f9b\u304f\u306a\u308b\u3002<\/li>\n<li>\u30d5\u30a1\u30a4\u30eb\u3092\u30d5\u30e9\u30c3\u30c8\u306b\u7f6e\u304d\u3059\u304e\u308b\u3068\u7ba1\u7406\u304c\u8f9b\u3044\u3002<\/li>\n<li>1\u30d5\u30a1\u30a4\u30eb\u306b\u7d71\u5408\u3059\u308b\u3068\u4fdd\u5b88\u304c\u8f9b\u3044\u3002<\/li>\n<\/ul>\n<h3>Redux-way<\/h3>\n<pre class=\"lang:default decode:true \">src\/\r\n  \u251c components\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n  \u251c containers\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n  \u251c reducers\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n  \u251c actions\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n  \u2514 types\/\r\n    \u251c \u6a5f\u80fd1.js\r\n     \u2514 \u6a5f\u80fd2.js<\/pre>\n<h4>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h4>\n<ul>\n<li>\u975e\u5e38\u306b\u666e\u901a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3060\u304c\u3001\u95b2\u89a7\u6027\u3084\u3001\u95a2\u9023\u6027\u304c\u7406\u89e3\u3057\u3065\u3089\u3044\u3002\uff08\u904e\u5270\u306a\u5206\u5272\u3001\u904e\u5270\u306a\u5206\u6563\uff09<\/li>\n<li>reducers\u3068action creators\u3001action types\u306f\u5bc6\u7d50\u5408\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u540c\u3058\u306b\u3057\u305f\u65b9\u304c\u826f\u3044\u3002<\/li>\n<\/ul>\n<h3>Ducks\u30d1\u30bf\u30fc\u30f3<\/h3>\n<p>actionType\u3001action-creator\u3001reducer\u304c\u6563\u3089\u3070\u3089\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3\u3002<\/p>\n<pre class=\"lang:default decode:true\">  \u251c components\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n \u251c containers\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n \u251c modules\r\n \u3000|   \u251c\u6a5f\u80fd1.ts(\u3053\u306e\u4e2d\u306bactionType\u3001action-creator\u3001reducer\u3092\u307e\u3068\u3081\u3066\u66f8\u304f\u3002)\r\n \u3000|   \u2514\u6a5f\u80fd2.ts<\/pre>\n<p>\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u6e1b\u3063\u3066\u30b9\u30c3\u30ad\u30ea\u3057\u307e\u3059\u304c\u3001\u3053\u308c\u3060\u30681\u30d5\u30a1\u30a4\u30eb\u304c\u80a5\u5927\u5316\u3057\u3059\u304e\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<h4>\u30e1\u30ea\u30c3\u30c8<\/h4>\n<p>1\u30d5\u30a1\u30a4\u30eb\u304c\u5c11\u306a\u3044\u5c0f\u898f\u6a21\u30a2\u30d7\u30ea\u306a\u3089\u30de\u30c3\u30c1\u3059\u308b\u3002<\/p>\n<h3>Re-ducks\uff08module\u3092\u518d\u5206\u5272\uff09\u30d1\u30bf\u30fc\u30f3<\/h3>\n<p>Ducs\u30d1\u30bf\u30fc\u30f3\u3092\u6539\u826f\u3057\u3066\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true \">  \u251c components\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n \u251c containers\/\r\n  |    \u251c \u6a5f\u80fd1.js\r\n  |    \u2514 \u6a5f\u80fd2.js\r\n  |    duck \r\n\u3000\u3000\u3000\u3000| \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u251c\u6a5f\u80fd1\r\n    \u251c index.ts\r\n    \u251c types.ts\r\n    \u251c actions.ts\r\n    \u251c reducers.ts\r\n    \u251c operations.ts\r\n    \u2514 selectors.ts\u3000\r\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u251c\u6a5f\u80fd2\r\n    \u251c index.ts\r\n    \u251c types.ts\r\n    \u251c actions.ts\r\n    \u251c reducers.ts\r\n    \u251c operations.ts\r\n    \u2514 selectors.ts<\/pre>\n<h4>operations<\/h4>\n<p>actions.ts\u306e\u524d\u306b\u5b9f\u884c\u3057\u305f\u3044\u300c\u4f55\u3089\u304b\u306e\u8907\u96d1\u306a\u51e6\u7406\u300d\u3092\u66f8\u304f\u305f\u3081\u306e\u5834\u6240(\u5916\u90e8API\u304b\u3089\u5024\u3092\u53d6\u5f97\u3059\u308b\u306a\u3069\u3001redux-thunk\u306a\u3069\u306e\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306f\u3053\u3053\u3067\u4f7f\u3046\u3002\uff09<\/p>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308bk\u3068\u304a\u3067actions.ts\u3084reducers.ts\u304c\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u308b\u3002<\/p>\n<h4><strong>selectors<\/strong><\/h4>\n<p>state\u304b\u3089\u5fc5\u8981\u306a\u5024\u3092\u7b97\u51fa\u3059\u308b\u95a2\u6570\u306e\u3053\u3068\u3002state\u304b\u3089\u8a08\u7b97\u3057\u3066\u53d6\u5f97\u3059\u308b\u5834\u5408\u306f\u5fc5\u305aselecors\u3092\u7d4c\u7531\u3057\u3066\u7b97\u51fa\u3059\u308b\u3002\u51e6\u7406\u3092\u30e1\u30e2\u5316\u3057\u305f\u3044\u5834\u5408\u306f\u3001<span style=\"color: #ff0000;\"><strong>reselect<\/strong><\/span>\u306a\u3069\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<h3>Reducer\u306e\u5206\u5272\u5358\u4f4d<\/h3>\n<h4>\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u30c4\u30ea\u30fc\u3054\u3068\u306e\u5206\u5272<\/h4>\n<p>\u753b\u9762\u3054\u3068\u306b\u5206\u5272\u3092\u3059\u308b\u3053\u3068\u3002<\/p>\n<pre class=\"lang:default decode:true \">reducers\r\n\u251c\u2500\u2500 newReducer.js\r\n\u251c\u2500\u2500 editReducer.js\r\n\u2514\u2500\u2500 showReducer.js<\/pre>\n<h4>\u30c9\u30e1\u30a4\u30f3\u30c7\u30fc\u30bf\u3054\u3068\u306e\u5206\u5272<\/h4>\n<p>\u5546\u58f2\u3001\u30ed\u30b0\u30a4\u30f3\u306a\u3069\u306e\u696d\u52d9\u3054\u3068\u306b\u5206\u5272\u3059\u308b\u3053\u3068\u3002<\/p>\n<pre class=\"lang:default decode:true\">reducers\r\n \u251c\u2500\u2500 shoppingReducer.js\r\n \u251c\u2500\u2500 loginReducer.js\r\n<\/pre>\n<h4>AppState<\/h4>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u306estate(\u30ed\u30b0\u30a4\u30f3\u72b6\u614b\u3084\u3001\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0\u72b6\u614b\u306a\u3069\uff09<\/p>\n<h4>UIState<\/h4>\n<p>\u4f8b\u3048\u3070\u3001\u30e2\u30fc\u30c0\u30eb\u3092\u8868\u793a\u3059\u308b\u304b\u3069\u3046\u304b\u306a\u3069\u306estate\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"&nbsp; \u3082\u3057\u9069\u7528\u3059\u308b\u306a\u3089\u306e\u8a71\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u3042\u307e\u308a\u9069\u7528\u3055\u308c\u3066\u3044\u308b\u6848\u4ef6\u306f\u898b\u305f\u3053\u3068\u306a\u3044\u3067\u3059\u304c\u3002\uff09 \u30d3\u30e5\u30fc\u30e2\u30c7\u30eb \u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3092\u8868\u793a\u306e\u305f\u3081\u306b\u5909\u63db\u3057\u305f\u3082\u306e\u3067\u3059\u3002SPA\u306e\u4e2d\u5fc3\u306b\u306f\u3053\u308c\u304c\u5c5e\u3057\u307e\u3059\u3002 \u30e6\u30fc\u30b9\u30b1\u30fc\u30b9 \u30d3\u30e5\u30fc\u30e2\u30c7\u30eb\u3092\u30b3 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[129],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14553"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14553"}],"version-history":[{"count":9,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14553\/revisions"}],"predecessor-version":[{"id":20151,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14553\/revisions\/20151"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14553"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}