{"id":353294,"date":"2024-05-20T22:25:07","date_gmt":"2024-05-20T22:25:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353294"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353294","title":{"rendered":"<span>CRUD React c Redux \u0438 Saga + typescript \u0432 2023<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e7d\/4f3\/d65\/e7d4f3d6543f507ef8fd83c590a817e9.png\" alt=\"\u044d\u0442\u043e \u0442\u0438\u043f\u0430 \u0441\u0443\u043f\" title=\"\u044d\u0442\u043e \u0442\u0438\u043f\u0430 \u0441\u0443\u043f\" width=\"1200\" height=\"577\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7d\/4f3\/d65\/e7d4f3d6543f507ef8fd83c590a817e9.png\"\/><\/p>\n<div><figcaption>\u044d\u0442\u043e \u0442\u0438\u043f\u0430 \u0441\u0443\u043f<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e <strong>Redux+Saga+Typescript.<\/strong> \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0432\u0438\u0434\u0435\u043b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c. redux + saga \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>\u0434\u0435\u0434\u043e\u0432\u0441\u043a\u0438\u043c<\/strong> \u043c\u0435\u0442\u043e\u0434\u043e\u043c ( \u0438\u0437 \u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <strong>\u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 &#8212; \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430<\/strong> ) , \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0435\u0435 redux-toolkit \u0441 RTK query \u0438\u043b\u0438 effector, \u043a\u043e\u043c\u0443 \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0438 mobx \ud83d\ude42 . \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u043e\u0441\u0442\u043e\u043c \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043e\u0434 \u043d\u0430 FSD \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u0441 redux-toolkit + RTK query \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<\/blockquote>\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u0438 \u043d\u0430 \u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043d\u043e \u044f\u0441\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 redux , saga \u0438 \u0438\u0445 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438 &#8212; \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0442 \u044d\u0442\u0430 <a href=\"https:\/\/habr.com\/ru\/companies\/usetech\/articles\/735914\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>. <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f, \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c <a href=\"https:\/\/github.com\/adss332\/ReduxSagaTsBlog\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>  ( \u0438 \u0434\u0430, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u043d\u0430 CRA, \u0430 \u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0435\u043b\u0435\u0442, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 vite \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 )<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442 \u043a\u043e\u0434 <strong>\u043f\u043e\u0434 CRUD<\/strong> \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0432\u044b\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0433\u0430.<\/p>\n<p>\u0418\u0434\u0435\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432 ( \u0432\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043e\u043a\u043d\u0435 ) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0445 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u043c\u043e\u043a API \u044f \u0432\u043e\u0437\u044c\u043c\u0443 \u0441 <a href=\"https:\/\/jsonplaceholder.typicode.com\/\" rel=\"noopener noreferrer nofollow\">https:\/\/jsonplaceholder.typicode.com<\/a>. <\/p>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p><a href=\"#consts\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#actions\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c actions<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#reducers\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c reducer<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#sagas\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c saga<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#store\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0432 store.<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#requests\" rel=\"noopener noreferrer nofollow\">\u041e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#types\" rel=\"noopener noreferrer nofollow\">\u041e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 <\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#components\" rel=\"noopener noreferrer nofollow\">\u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043f\u0440\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0443 redux \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 : <\/p>\n<ul>\n<li>\n<p><strong>State (\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435)<\/strong>: \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 Redux \u043b\u0435\u0436\u0438\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0435\u0434\u0438\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>Actions (\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f)<\/strong>: \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8212; \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438\u043b\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c. \u041e\u043d\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u0438 \u0441\u0430\u0433\u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Reducers (\u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b)<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u041e\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>Sagas (\u0421\u0430\u0433\u0438)<\/strong>: \u0421\u0430\u0433\u0438 &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u0421\u0430\u0433\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u043d\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p><strong>Effects (\u042d\u0444\u0444\u0435\u043a\u0442\u044b)<\/strong>: \u042d\u0444\u0444\u0435\u043a\u0442\u044b \u0432 \u0441\u0430\u0433\u0430\u0445 \u0441\u043b\u0443\u0436\u0430\u0442 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0442\u0438\u043f\u044b \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441\u0430\u0433\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>Store (\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435)<\/strong>: \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0432 Redux \u0441\u043b\u0443\u0436\u0438\u0442 \u043a\u0430\u043a \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u0432 \u0438 \u0441\u0430\u0433 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041e\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<\/ul>\n<p><strong><em>\u041f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b<\/em><\/strong><em>\u00a0\u2014 \u043a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430\u00a0\u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0441\u0440\u0435\u0434\u0443. ( \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043c\u0443\u0442\u0430\u0446\u0438\u044f, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 DOM \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0442.\u043f  )<\/em><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 ( \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 ) \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u0434<\/h2>\n<p><a class=\"anchor\" name=\"consts\" id=\"consts\"><\/a><\/p>\n<h2>1. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 \u0432 actions.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0432\u044b\u043d\u043e\u0448\u0443 \u0438\u0445 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b\u0438\u043a \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438. C\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0438 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u044c:<\/p>\n<p><code>const CREATE_POST_REQUEST = \"CREATE_POST_REQUEST\";<\/code><\/p>\n<p>\u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p><code>const CREATE_POST_REQUEST = \"CREATE_POST_REQUEST_V1\";<\/code><\/p>\n<p><code>const CREATE_POST_REQUEST_V2 = \"CREATE_POST_REQUEST_V2\";<\/code><\/p>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043b\u0443\u0436\u0438\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u0442\u0438\u043f\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f ( action ) \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0440\u0443\u0434\u0430.<\/p>\n<p>\u041a \u0441\u043b\u043e\u0432\u0443 &#8212; actions \u0443 \u043d\u0430\u0441 \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 &#8212; \u0441\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441, \u0438 \u0434\u0432\u0430 \u0438\u0441\u0445\u043e\u0434\u0430 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 <br \/>( success,failure ). \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>src\/consts\/posts\/PostsConsts.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export const FETCH_POSTS_REQUEST = 'FETCH_POSTS_REQUEST'; export const FETCH_POSTS_SUCCESS = 'FETCH_POSTS_SUCCESS'; export const FETCH_POSTS_FAILURE = 'FETCH_POSTS_FAILURE';  export const CREATE_POST_REQUEST = 'CREATE_POST_REQUEST'; export const CREATE_POST_SUCCESS = 'CREATE_POST_SUCCESS'; export const CREATE_POST_FAILURE = 'CREATE_POST_FAILURE';  export const UPDATE_POST_REQUEST = 'UPDATE_POST_REQUEST'; export const UPDATE_POST_SUCCESS = 'UPDATE_POST_SUCCESS'; export const UPDATE_POST_FAILURE = 'UPDATE_POST_FAILURE';  export const DELETE_POST_REQUEST = 'DELETE_POST_REQUEST'; export const DELETE_POST_SUCCESS = 'DELETE_POST_SUCCESS'; export const DELETE_POST_FAILURE = 'DELETE_POST_FAILURE';<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"actions\" id=\"actions\"><\/a><\/p>\n<h2>2. Actions<\/h2>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b <strong>\u0424\u0443\u043d\u043a\u0446\u0438\u0438-\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0439 ( Action Creators )<\/strong>: \u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0438\u043f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f ( \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432\u044b\u0448\u0435 ) \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0418\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u0440\u0433\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445, \u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0430\u0445 \u0438 \u0441\u0430\u0433\u0430\u0445. <\/p>\n<p>\u0421\u0430\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043a\u0448\u043d \u043a\u0440\u0435\u044d\u0439\u0442\u043e\u0440\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 &#8212; \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432: <\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/strong> &#8212; { \u0442\u0438\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 }{ \u0438\u043c\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 }{ \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043b\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u0430 }.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442<\/strong> &#8212; \u043e\u0431\u044b\u0447\u043d\u043e \u0435\u0433\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 data \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u043e\u0431\u0449\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c. \u0410 \u0441\u0430\u043c \u0442\u0438\u043f \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c case \u0438 \u0441 \u0434\u043e\u0431\u0430\u0432\u043e\u0447\u043d\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c Interface\/Type.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong> &#8212; \u0442\u043e\u0436\u0435 \u0442\u0438\u043f, \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0438 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0443\u0434\u0430 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e Action \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 , \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/strong> &#8212; \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 &#8212; type \u0438 payload, \u0432 \u043f\u0435\u0440\u0432\u043e\u0435 \u043a\u043b\u0430\u0434\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0442\u0438\u043f\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 (data).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u043a\u0448\u043d \u043a\u0440\u0435\u044d\u0439\u0442\u043e\u0440\u043e\u0432 &#8212; \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/actions\/postsActions.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export const updatePostRequest = (data: UpdatePostRequestInterface): UpdatePostRequestActionInterface => ({   type: UPDATE_POST_REQUEST,   payload: data });  export const updatePostSuccess = (data: UpdatePostSuccessResponseInterface): UpdatePostSuccessActionInterface => ({   type: UPDATE_POST_SUCCESS,   payload: data });  export const updatePostFailure = (error: string): UpdatePostFailureActionInterface => ({   type: UPDATE_POST_FAILURE,   payload: {     message: error   }, });  export const createPostRequest = (data: CreatePostRequestInterface): CreatePostRequestActionInterface => ({   type: CREATE_POST_REQUEST,   payload: data });  export const createPostSuccess = (data: CreatePostSuccessResponseInterface): CreatePostSuccessActionInterface => ({   type: CREATE_POST_SUCCESS,   payload: data });  export const createPostFailure = (error: string): CreatePostFailureActionInterface => ({   type: CREATE_POST_FAILURE,   payload: {     message: error   }, });  export const deletePostRequest = (data: DeletePostRequestInterface): DeletePostRequestActionInterface => ({   type: DELETE_POST_REQUEST,   payload: data });  export const deletePostSuccess = (data: {}): DeletePostSuccessActionInterface => ({   type: DELETE_POST_SUCCESS,   payload: data });  export const deletePostFailure = (error: string): DeletePostFailureActionInterface => ({   type: DELETE_POST_FAILURE,   payload: {     message: error   }, });  export const fetchPostsRequest = (): FetchPostsRequestActionInterface => ({   type: FETCH_POSTS_REQUEST, });  export const fetchPostsSuccess = (data: FetchPostsSuccessResponseInterface): FetchPostsSuccessActionInterface => ({   type: FETCH_POSTS_SUCCESS,   payload: data, });  export const fetchPostsFailure = (error: string): FetchPostsFailureActionInterface => ({   type: FETCH_POSTS_FAILURE,   payload: {     message: error   }, });<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u0433\u0434\u0430 actions \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 &#8212; \u043e\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 Redux store \u0447\u0435\u0440\u0435\u0437 <code>dispatch<\/code> \u043c\u0435\u0442\u043e\u0434. \u042d\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u00a0\u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 redux dispatch &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u00a0action,\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442 \u043d\u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u00a0\u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p><code>dispatch(updatePostRequest(data));<\/code><\/p>\n<p>\u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/github.com\/adss332\/ReduxSagaTsBlog\/blob\/main\/src\/components\/pages\/posts\/PostsList.tsx\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u0443\u044e \u0432\u0441\u0435 \u0447\u0442\u043e \u043c\u043e\u0433\u0443 &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445. \u0411\u043b\u0438\u0436\u0435 \u043a \u043a\u043e\u043d\u0446\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u043f\u0438\u0448\u0443 \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0440\u0443\u0434\u0430. <\/p>\n<p><a class=\"anchor\" name=\"reducers\" id=\"reducers\"><\/a><\/p>\n<h2>3. Reducers<\/h2>\n<p>\u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u0432 \u044d\u0442\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435 Redux \u0438\u0433\u0440\u0430\u044e\u0442 \u0440\u043e\u043b\u044c &#171;\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445&#187; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. <\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0438\u0448\u043a\u0438 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u0432: <\/p>\n<ol>\n<li>\n<p><strong>\u0418\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432 \u043a\u043e\u0434\u0435. \u0418\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430 \u043f\u043e\u0441\u043b\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Switch Statements<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <a href=\"https:\/\/learn.javascript.ru\/switch\" rel=\"noopener noreferrer nofollow\">switch<\/a> \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 &#8212; \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044f\u0432\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u0430<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0447\u0438\u0441\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0432\u044b\u0432\u043e\u0434, \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c <strong>\u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432<\/strong> (\u0432\u043d\u0443\u0442\u0440\u044c \u043d\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0434\u043e \u043a\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u043e\u043c) .<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u0435\u0440\u0445\u0443 \u043b\u0435\u0436\u0438\u0442 initial \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0434\u044e\u0441\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438, \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043e\u043d \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f &#8212; action. \u0412\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/learn.javascript.ru\/switch\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u0438\u0442\u0447 \u043a\u0435\u0439\u0441<\/a> \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 &#8212; \u043e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. <\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/reducers\/postsReducer.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>const initialState: PostsState = {   posts: [],   successMessage: null,   isLoading: false,   error: null, };  export const postsReducer = (state = initialState, action: PostsActions) => {   switch (action.type) {     case FETCH_POSTS_REQUEST:       return {         ...state,         isLoading: true,         successMessage: null,         error: null,       };     case FETCH_POSTS_SUCCESS:       return {         ...state,         isLoading: false,         posts: action.payload       };     case FETCH_POSTS_FAILURE:       return {         ...state,         isLoading: false,         error: action.payload.message       };     case CREATE_POST_REQUEST:       return {         ...state,         isLoading: true,         successMessage: null,         error: null,       };     case CREATE_POST_SUCCESS:       return {         ...state,         isLoading: false,         posts: [ action.payload, ...state.posts ],         successMessage: 'Post created!'       };     case CREATE_POST_FAILURE:       return {         ...state,         isLoading: false,         successMessage: null,         error: 'Post was not created',       };     case UPDATE_POST_REQUEST:       return {         ...state,         isLoading: true,         successMessage: null,         error: null,       };     case UPDATE_POST_SUCCESS:       return {         ...state,         isLoading: false,         posts: state.posts.map(p => p.id === action.payload.id ? action.payload : p) as PostType[],         successMessage: 'Post updated!',         error: null       };     case UPDATE_POST_FAILURE:       return {         ...state,         isLoading: false,         successMessage: null,         error: 'Post was not updated',       };     case DELETE_POST_REQUEST:       return {         ...state,         isLoading: true,         successMessage: null,         error: null,       };     case DELETE_POST_SUCCESS:       return {         ...state,         isLoading: false,         successMessage: 'Post deleted',         error: null,       };     case DELETE_POST_FAILURE:       return {         ...state,         isLoading: false,         successMessage: null,         error: 'Post was not deleted',       };     default:       return state;   } };  export default postsReducer;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e postsReducer \u0443 \u043d\u0430\u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0440\u0435\u0434\u044e\u0441\u0435\u0440. ( \u043f\u043e \u0441\u0443\u0442\u0438 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u043d\u0435\u0433\u043e, \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u044f \u043f\u0438\u0448\u0443 \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0436\u0435 ) \u041e\u0431\u044b\u0447\u043d\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0440\u0435\u0434\u044e\u0441\u0435\u0440 \u043b\u0435\u0436\u0438\u0442 \u0432 index.ts. \u0415\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 <strong>store<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/reducers\/index.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export interface RootState {   posts: PostsState; }  const rootReducer = combineReducers&lt;RootState>({   posts: postsReducer });  export default rootReducer;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 RootState \u0441\u0432\u0435\u0440\u0445\u0443.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>combineReducers<\/strong> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0440\u0435\u0437\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u044b.<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u043c\u0435\u0441\u0442\u0435 \u0441 <strong>Redux-Saga<\/strong> \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 &#171;\u0440\u0443\u043a\u0430 \u043e\u0431 \u0440\u0443\u043a\u0443&#187; \u0441 \u0441\u0430\u0433\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0430\u0433\u0430\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <strong>\u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432<\/strong> ( \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 ), \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p><a class=\"anchor\" name=\"sagas\" id=\"sagas\"><\/a><\/p>\n<h2>4. Sagas<\/h2>\n<p>\u0421\u0430\u0433\u0430 &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0441\u043b\u043e\u0439, \u0438\u0433\u0440\u0430\u044e\u0449\u0438\u0439 \u0441\u0432\u043e\u044e \u0440\u043e\u043b\u044c \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0430 \u044d\u043a\u0448\u0435\u043d\u0430 \u0438 \u0434\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0435\u0433\u043e \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u043c. \u0421\u0430\u0433\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f<a href=\"https:\/\/learn.javascript.ru\/generators\" rel=\"noopener noreferrer nofollow\"> \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438<\/a>.<\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/JavaScript\/Reference\/Operators\/yield\" rel=\"noopener noreferrer nofollow\">\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/a> <code>yield<\/code> ( \u043f\u043e \u0442\u0438\u043f\u0443 return, \u043d\u043e return \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 ) \u0434\u043b\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430. <\/p>\n<p>\u0412 \u0441\u043b\u043e\u0435 \u0441\u0430\u0433 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043a\u0430\u043a <strong>\u0441\u0430\u0433\u0438-\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438<\/strong> \u0438 <strong>\u0441\u0430\u0433\u0438-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438<\/strong>. <\/p>\n<ul>\n<li>\n<p><strong>\u0421\u0430\u0433\u0438-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438<\/strong> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 action \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0437\u043e\u0432 API. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 actions, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0430\u0433\u0438-\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u0438<\/strong>, \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u044d\u043a\u0448\u0435\u043d\u043e\u0432, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0430\u0433\u0438-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u044d\u043a\u0448\u0435\u043d\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>src\/redux\/sagas\/postsSaga.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>function* updatePostWorker(action: Action&lt;typeof UPDATE_POST_REQUEST> &amp; UpdatePostRequestActionInterface): Generator {   try {     const data = action.payload;     const response = (yield call(updatePostRequest, data)) as UpdatePostSuccessResponseInterface;     yield put(updatePostSuccess(response));     \/\/ yield put(fetchPostsRequest());   } catch (error) {     yield put(updatePostFailure('error update post'));   } }  function* createPostWorker(action: Action&lt;typeof CREATE_POST_REQUEST> &amp; CreatePostRequestActionInterface): Generator {   try {     const data = action.payload;     const response = (yield call(createPostRequest, data)) as CreatePostSuccessResponseInterface;     yield put(createPostSuccess(response));     \/\/ yield put(fetchPostsRequest());   } catch (error) {     yield put(createPostFailure('error create post'));   } }  function* deletePostWorker(action: Action&lt;typeof DELETE_POST_REQUEST> &amp; DeletePostRequestActionInterface): Generator {   try {     const { id } = action.payload;     const response = (yield call(deletePostRequest, id)) as {};     yield put(deletePostSuccess(response));     yield put(fetchPostsRequest());   } catch (error) {     yield put(deletePostFailure('error delete post'));   } }  function* fetchPostsWorker(action: Action&lt;typeof FETCH_POSTS_REQUEST> &amp; FetchPostsRequestActionInterface): Generator {   try {     const response = (yield call(getPostsRequest)) as FetchPostsSuccessResponseInterface;     yield put(fetchPostsSuccess(response));   } catch (error) {     yield put(fetchPostsFailure('error fetch posts'));   } }  export function* postsSagaWatcher(): Generator {   yield takeLatest(FETCH_POSTS_REQUEST, fetchPostsWorker);   yield takeLatest(DELETE_POST_REQUEST, deletePostWorker);   yield takeLatest(CREATE_POST_REQUEST, createPostWorker);   yield takeLatest(UPDATE_POST_REQUEST, updatePostWorker); }<\/code><\/pre>\n<p><strong>call<\/strong> \u044d\u0444\u0444\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p><strong>put<\/strong> \u044d\u0444\u0444\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 (dispatch) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432 Redux store.<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e postsSaga \u0443 \u043d\u0430\u0441 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u0441\u0430\u0433\u0430, \u043a\u0430\u043a \u0438 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0440\u0435\u0434\u044e\u0441\u0435\u0440. \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u043c \u043a\u0430\u043a middleware. Middleware &#8212; \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043a\u0430\u043a \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u043c\u0435\u0448\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0435\u0449\u0435 \u043a\u0430\u043a\u0438\u0445 \u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. <\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/sagas\/index.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>function* rootSaga() {   yield all([ fork(postsSagaWatcher) ]); }  export default rootSaga;<\/code><\/pre>\n<p>\u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>fork<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c <strong>postsSagaWatcher<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0430\u0433 \u0438\u043b\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 <strong>all<\/strong>.<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\"><\/a><\/p>\n<h2>5. Store<\/h2>\n<p>Store \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u0443\u0436\u0438\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 Redux, \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/store\/index.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>const sagaMiddleware = createSagaMiddleware();  const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;  const store = createStore(   rootReducer,   composeEnhancers(applyMiddleware(sagaMiddleware)) );  sagaMiddleware.run(rootSaga);  export default store;<\/code><\/pre>\n<p><strong>sagaMiddleware:<\/strong> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 middleware \u0441\u0430\u0433\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>createSagaMiddleware. <\/strong>\u0412\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 run \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<p><strong>Enhancers<\/strong> &#8212; \u044d\u0442\u043e \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f middleware, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u0438. (<a href=\"https:\/\/www.tune-it.ru\/web\/bleizard\/blog\/-\/blogs\/redux-middleware-funkcii-usiliteli-pogruzenie-v-el-fijskij?_com_liferay_blogs_web_portlet_BlogsPortlet_redirect=https%3A%2F%2Fwww.tune-it.ru%2Fweb%2Fbleizard%2Fblog%2F-%2Fblogs%2Fredux-middleware-funkcii-usiliteli-pogruzenie-v-el-fijskij#disqus_thread\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442<\/a> \u043a\u0441\u0442\u0430\u0442\u0438 \u0441\u0442\u0430\u0440\u0435\u043d\u044c\u043a\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043a\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c). <\/p>\n<p><strong>applyMiddleware<\/strong> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 middleware \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u044c (\u0432 \u043a\u043e\u0434\u0435 createStore \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c enhance). <\/p>\n<\/p>\n<\/div>\n<\/details>\n<p>\u042d\u0442\u043e\u0442 store \u043c\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041e\u043d \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c \u0441\u0443\u043f\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430. <\/p>\n<details class=\"spoiler\">\n<summary>src\/index.tsx<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>ReactDOM.render(   &lt;Provider store={store}>     &lt;App \/>   &lt;\/Provider>,   document.getElementById('root') );<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"requests\" id=\"requests\"><\/a><\/p>\n<h2>6. \u041e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/h2>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 saga \u0447\u0435\u0440\u0435\u0437 <strong>call<\/strong> \u044d\u0444\u0444\u0435\u043a\u0442 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/axios-http.com\/ru\/docs\/intro\" rel=\"noopener noreferrer nofollow\">Axios<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>src\/api\/posts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>const postsApi = axios.create({   baseURL: 'https:\/\/jsonplaceholder.typicode.com\/', });  export const getPostsRequest = async () => {   const response = await postsApi.get('posts');   return response.data; }  export const deletePostRequest = async (id: number) => {   const response = await postsApi.delete(`posts\/${ id }`);   return response.data; }  export const createPostRequest = async (data: CreatePostRequestInterface) => {   const response = await postsApi.post(`\/posts`, data, {     headers: {       'Content-Type': 'application\/json'     }   });   return response.data; }  export const updatePostRequest = async (data: UpdatePostRequestInterface) => {   const response = await postsApi.put(`\/posts\/${ data.postId }`, data, {     headers: {       'Content-Type': 'application\/json'     }   });   return response.data; }<\/code><\/pre>\n<p>\u0432 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c url.<\/p>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b <\/p>\n<ol>\n<li>\n<p><code>async<\/code>: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439. \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 <a href=\"https:\/\/learn.javascript.ru\/promise\" rel=\"noopener noreferrer nofollow\">Promise<\/a>, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0438\u0445 \u043d\u0435\u0442 \u044f\u0432\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043f\u0440\u043e\u043c\u0438\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p><code>await<\/code>: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043e\u043d\u043e &#171;\u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442&#187; \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u043c\u0438\u0441 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b <code>postsApi.get('posts')<\/code>) \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u043c\u0438\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, <code>await<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u043c\u0438\u0441\u0430, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442\u0441\u044f<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"types\" id=\"types\"><\/a><\/p>\n<h2>7. \u041e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a \u0438\u0442\u0430\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 redux \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438. \u0422\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 &#8212; \u043a \u043d\u0435\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u0441 \u0443\u043c\u043e\u043c, \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f. <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u0440\u0443\u0434\u0430 \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443:<\/p>\n<p>1) \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0415\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u043b\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0434 update \u0438 create, \u0442.\u043a \u043e\u043d\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u044d\u0442\u0438 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043d \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u043f\u043e\u0434 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>interfaces\/PostOperationInterface.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export interface PostOperationInterface {   userId: number;   title: string;   body: string; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2) \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043f\u043e\u0434 \u043a\u0440\u0443\u0434 \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b. \u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043b \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b\u0438\u043a. \u0430 \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u0435 \u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u044f \u0431\u044b \u0438\u0445 \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>interfaces\/PostsCrudRequests.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export interface CreatePostRequestInterface extends PostOperationInterface { }  export interface DeletePostRequestInterface {   id: number; }  export interface UpdatePostRequestInterface extends PostOperationInterface {   postId: number; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>3) \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0434 PostType. \u0415\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u043b\u044f \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0432 \u0440\u0435\u0441\u043f\u043e\u043d\u0441\u0430\u0445 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>interfaces\/PostType.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export interface PostType {   id: number;   userId: number;   title: string;   body: string; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>4) \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043f\u043e\u0434 \u043a\u0440\u0443\u0434 \u0440\u0435\u0441\u043f\u043e\u043d\u0441\u044b. \u0414\u0443\u043c\u0430\u044e \u0432\u0441\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f.<\/p>\n<details class=\"spoiler\">\n<summary>interfaces\/PostCrudResponses.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export interface FetchPostsSuccessResponseInterface extends Array&lt;PostType> { }  export interface PostsFailureResponseInterface {   message: string; }  export interface CreatePostSuccessResponseInterface extends PostType { }  export interface UpdatePostSuccessResponseInterface extends PostType { }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>5) \u041d\u0443 \u0438 \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043f\u043e\u0434 actions \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u0432\u044b\u0448\u0435. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 PostsActions, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0435. \u0427\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043e\u043d \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043a\u0430\u043a\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0442\u0443\u0434\u0430 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f actions \u043f\u043e \u0442\u0438\u043f\u0430\u043c <\/p>\n<details class=\"spoiler\">\n<summary>interfaces\/PostsActions.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>\/\/ Get export interface FetchPostsRequestActionInterface extends Action&lt;typeof FETCH_POSTS_REQUEST> {   type: typeof FETCH_POSTS_REQUEST; }  export interface FetchPostsSuccessActionInterface extends Action&lt;typeof FETCH_POSTS_SUCCESS> {   type: typeof FETCH_POSTS_SUCCESS;   payload: FetchPostsSuccessResponseInterface; }  export interface FetchPostsFailureActionInterface extends Action&lt;typeof FETCH_POSTS_FAILURE> {   type: typeof FETCH_POSTS_FAILURE;   payload: PostsFailureResponseInterface; }  \/\/Delete export interface DeletePostRequestActionInterface extends Action&lt;typeof DELETE_POST_REQUEST> {   type: typeof DELETE_POST_REQUEST;   payload: DeletePostRequestInterface }  export interface DeletePostSuccessActionInterface extends Action&lt;typeof DELETE_POST_SUCCESS> {   type: typeof DELETE_POST_SUCCESS;   payload: {} }  export interface DeletePostFailureActionInterface extends Action&lt;typeof DELETE_POST_FAILURE> {   type: typeof DELETE_POST_FAILURE;   payload: PostsFailureResponseInterface }  \/\/Create export interface CreatePostRequestActionInterface extends Action&lt;typeof CREATE_POST_REQUEST> {   type: typeof CREATE_POST_REQUEST;   payload: CreatePostRequestInterface }  export interface CreatePostSuccessActionInterface extends Action&lt;typeof CREATE_POST_SUCCESS> {   type: typeof CREATE_POST_SUCCESS;   payload: CreatePostSuccessResponseInterface }  export interface CreatePostFailureActionInterface extends Action&lt;typeof CREATE_POST_FAILURE> {   type: typeof CREATE_POST_FAILURE;   payload: PostsFailureResponseInterface }  \/\/Update export interface UpdatePostRequestActionInterface extends Action&lt;typeof UPDATE_POST_REQUEST> {   type: typeof UPDATE_POST_REQUEST;   payload: UpdatePostRequestInterface }  export interface UpdatePostSuccessActionInterface extends Action&lt;typeof UPDATE_POST_SUCCESS> {   type: typeof UPDATE_POST_SUCCESS;   payload: UpdatePostSuccessResponseInterface }  export interface UpdatePostFailureActionInterface extends Action&lt;typeof UPDATE_POST_FAILURE> {   type: typeof UPDATE_POST_FAILURE;   payload: PostsFailureResponseInterface }  export type PostsActions =   CreatePostRequestActionInterface   | CreatePostFailureActionInterface   | CreatePostSuccessActionInterface   | UpdatePostRequestActionInterface   | UpdatePostFailureActionInterface   | UpdatePostSuccessActionInterface   | DeletePostRequestActionInterface   | DeletePostFailureActionInterface   | DeletePostSuccessActionInterface   | FetchPostsRequestActionInterface   | FetchPostsSuccessActionInterface   | FetchPostsFailureActionInterface   ;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>6) \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0444\u0430\u0439\u043b\u0438\u043a \u043f\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0435 <\/p>\n<details class=\"spoiler\">\n<summary>interfaces\/PostsState.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export interface PostsState {   posts: PostType[];   successMessage: string | null,   isLoading: boolean;   error: string | null; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"components\" id=\"components\"><\/a><\/p>\n<h2>8. \u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c &#8212; \u044f \u043d\u0435 \u0432\u0438\u0436\u0443 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043a\u0440\u0430\u0442\u0446\u0435.<\/p>\n<p>\u041f\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c<\/p>\n<ol>\n<li>\n<p><strong>PostsPage.tsx  <\/strong>&#8212; c\u0442\u0440\u0430\u043d\u0438\u0446\u0430  ( \u0432 \u043d\u0435\u0439 \u0442\u0430\u043a\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u043f\u0430\u043f \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/fkhadra.github.io\/react-toastify\/introduction\/\" rel=\"noopener noreferrer nofollow\">react-toastify<\/a> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043a\u0440\u0443\u0434\u0430 ).<\/p>\n<\/li>\n<li>\n<p><strong>PostsList.tsx<\/strong> &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0435 (\u043d\u0430 \u0445\u0443\u043a\u0435 useEffect) \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 fetch \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u0441\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>PostCard.tsx<\/strong> &#8212; \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u0441\u0442\u0430, \u0442\u0443\u0442 \u0432\u0441\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 \u0438\u043c\u0435\u0435\u0442\u0441\u044f<strong> AddPostButton.tsx<\/strong> &#8212; \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u043e\u043f\u0430\u043f\u0430 \u043d\u0430 \u0440\u0435\u0436\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430.<\/p>\n<p><strong>PostPopup.tsx<\/strong> &#8212; \u0442\u043e\u0436\u0435 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0441\u0430\u043c \u043f\u043e\u043f\u0430\u043f. <\/p>\n<p>** \u0415\u0441\u043b\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043f\u0430\u043f \u043a \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441ommon \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c <a href=\"https:\/\/github.com\/adss332\/ReduxSagaTsBlog\/tree\/main\/src\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <\/h2>\n<p>\u041f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c , \u0447\u0442\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u0438 \u043f\u043b\u044e\u0441\u043e\u043c \u0434\u0430\u0441\u0442 \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0436\u0435 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 ( \u0448\u0443\u0442\u043a\u0430 \u043f\u0440\u043e \u0442\u043e \u0447\u0442\u043e redux saga \u0438\u0442\u0430\u043a \u0431\u0435\u0441\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u044b \u0442\u0443\u0442 \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \ud83d\ude42 ) \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 ! \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0442\u0435\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0436\u0435 \u043f\u0440\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0431\u0435\u0441\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0441 \u0441 RTK query <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/757230\/\"> https:\/\/habr.com\/ru\/articles\/757230\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>\u044d\u0442\u043e \u0442\u0438\u043f\u0430 \u0441\u0443\u043f<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e <strong>Redux+Saga+Typescript.<\/strong> \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0432\u0438\u0434\u0435\u043b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0438 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c. redux + saga \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>\u0434\u0435\u0434\u043e\u0432\u0441\u043a\u0438\u043c<\/strong> \u043c\u0435\u0442\u043e\u0434\u043e\u043c ( \u0438\u0437 \u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <strong>\u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 &#8212; \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430<\/strong> ) , \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0435\u0435 redux-toolkit \u0441 RTK query \u0438\u043b\u0438 effector, \u043a\u043e\u043c\u0443 \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0438 mobx \ud83d\ude42 . \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u043e\u0441\u0442\u043e\u043c \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043e\u0434 \u043d\u0430 FSD \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u0441 redux-toolkit + RTK query \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<\/blockquote>\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u0438 \u043d\u0430 \u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043d\u043e \u044f\u0441\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 redux , saga \u0438 \u0438\u0445 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438 &#8212; \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0442 \u044d\u0442\u0430 <a href=\"https:\/\/habr.com\/ru\/companies\/usetech\/articles\/735914\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>. <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f, \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c <a href=\"https:\/\/github.com\/adss332\/ReduxSagaTsBlog\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>  ( \u0438 \u0434\u0430, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u043d\u0430 CRA, \u0430 \u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0435\u043b\u0435\u0442, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 vite \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 )<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442 \u043a\u043e\u0434 <strong>\u043f\u043e\u0434 CRUD<\/strong> \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0432\u044b\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0433\u0430.<\/p>\n<p>\u0418\u0434\u0435\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432 ( \u0432\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043e\u043a\u043d\u0435 ) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0445 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u043c\u043e\u043a API \u044f \u0432\u043e\u0437\u044c\u043c\u0443 \u0441 <a href=\"https:\/\/jsonplaceholder.typicode.com\/\" rel=\"noopener noreferrer nofollow\">https:\/\/jsonplaceholder.typicode.com<\/a>. <\/p>\n<h2>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p><a href=\"#consts\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#actions\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c actions<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#reducers\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c reducer<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#sagas\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c saga<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#store\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0432 store.<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#requests\" rel=\"noopener noreferrer nofollow\">\u041e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#types\" rel=\"noopener noreferrer nofollow\">\u041e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 <\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#components\" rel=\"noopener noreferrer nofollow\">\u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043f\u0440\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b<\/a><\/p>\n<\/li>\n<\/ol>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0443 redux \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 : <\/p>\n<ul>\n<li>\n<p><strong>State (\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435)<\/strong>: \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 Redux \u043b\u0435\u0436\u0438\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0435\u0434\u0438\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>Actions (\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f)<\/strong>: \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8212; \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438\u043b\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c. \u041e\u043d\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u0438 \u0441\u0430\u0433\u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Reducers (\u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b)<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u041e\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>Sagas (\u0421\u0430\u0433\u0438)<\/strong>: \u0421\u0430\u0433\u0438 &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u0421\u0430\u0433\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u043d\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p><strong>Effects (\u042d\u0444\u0444\u0435\u043a\u0442\u044b)<\/strong>: \u042d\u0444\u0444\u0435\u043a\u0442\u044b \u0432 \u0441\u0430\u0433\u0430\u0445 \u0441\u043b\u0443\u0436\u0430\u0442 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0442\u0438\u043f\u044b \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441\u0430\u0433\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>Store (\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435)<\/strong>: \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0432 Redux \u0441\u043b\u0443\u0436\u0438\u0442 \u043a\u0430\u043a \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u0432 \u0438 \u0441\u0430\u0433 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041e\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<\/ul>\n<p><strong><em>\u041f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b<\/em><\/strong><em>\u00a0\u2014 \u043a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430\u00a0\u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0441\u0440\u0435\u0434\u0443. ( \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043c\u0443\u0442\u0430\u0446\u0438\u044f, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 DOM \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0442.\u043f  )<\/em><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 ( \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 ) \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u0434<\/h2>\n<p><a class=\"anchor\" name=\"consts\" id=\"consts\"><\/a><\/p>\n<h2>1. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 \u0432 actions.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0432\u044b\u043d\u043e\u0448\u0443 \u0438\u0445 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b\u0438\u043a \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438. C\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0438 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u044c:<\/p>\n<p><code>const CREATE_POST_REQUEST = \"CREATE_POST_REQUEST\";<\/code><\/p>\n<p>\u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p><code>const CREATE_POST_REQUEST = \"CREATE_POST_REQUEST_V1\";<\/code><\/p>\n<p><code>const CREATE_POST_REQUEST_V2 = \"CREATE_POST_REQUEST_V2\";<\/code><\/p>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043b\u0443\u0436\u0438\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u0442\u0438\u043f\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f ( action ) \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0440\u0443\u0434\u0430.<\/p>\n<p>\u041a \u0441\u043b\u043e\u0432\u0443 &#8212; actions \u0443 \u043d\u0430\u0441 \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 &#8212; \u0441\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441, \u0438 \u0434\u0432\u0430 \u0438\u0441\u0445\u043e\u0434\u0430 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 <br \/>( success,failure ). \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>src\/consts\/posts\/PostsConsts.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export const FETCH_POSTS_REQUEST = 'FETCH_POSTS_REQUEST'; export const FETCH_POSTS_SUCCESS = 'FETCH_POSTS_SUCCESS'; export const FETCH_POSTS_FAILURE = 'FETCH_POSTS_FAILURE';  export const CREATE_POST_REQUEST = 'CREATE_POST_REQUEST'; export const CREATE_POST_SUCCESS = 'CREATE_POST_SUCCESS'; export const CREATE_POST_FAILURE = 'CREATE_POST_FAILURE';  export const UPDATE_POST_REQUEST = 'UPDATE_POST_REQUEST'; export const UPDATE_POST_SUCCESS = 'UPDATE_POST_SUCCESS'; export const UPDATE_POST_FAILURE = 'UPDATE_POST_FAILURE';  export const DELETE_POST_REQUEST = 'DELETE_POST_REQUEST'; export const DELETE_POST_SUCCESS = 'DELETE_POST_SUCCESS'; export const DELETE_POST_FAILURE = 'DELETE_POST_FAILURE';<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"actions\" id=\"actions\"><\/a><\/p>\n<h2>2. Actions<\/h2>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b <strong>\u0424\u0443\u043d\u043a\u0446\u0438\u0438-\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0439 ( Action Creators )<\/strong>: \u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0438\u043f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f ( \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432\u044b\u0448\u0435 ) \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0418\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u0440\u0433\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445, \u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0430\u0445 \u0438 \u0441\u0430\u0433\u0430\u0445. <\/p>\n<p>\u0421\u0430\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043a\u0448\u043d \u043a\u0440\u0435\u044d\u0439\u0442\u043e\u0440\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 &#8212; \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432: <\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/strong> &#8212; { \u0442\u0438\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 }{ \u0438\u043c\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 }{ \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043b\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u0430 }.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442<\/strong> &#8212; \u043e\u0431\u044b\u0447\u043d\u043e \u0435\u0433\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 data \u0438 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u043e\u0431\u0449\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c \u0442\u0438\u043f\u043e\u043c. \u0410 \u0441\u0430\u043c \u0442\u0438\u043f \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u043c case \u0438 \u0441 \u0434\u043e\u0431\u0430\u0432\u043e\u0447\u043d\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c Interface\/Type.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong> &#8212; \u0442\u043e\u0436\u0435 \u0442\u0438\u043f, \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0438 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0443\u0434\u0430 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e Action \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 , \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/strong> &#8212; \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 &#8212; type \u0438 payload, \u0432 \u043f\u0435\u0440\u0432\u043e\u0435 \u043a\u043b\u0430\u0434\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0442\u0438\u043f\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 (data).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u043a\u0448\u043d \u043a\u0440\u0435\u044d\u0439\u0442\u043e\u0440\u043e\u0432 &#8212; \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/actions\/postsActions.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>export const updatePostRequest = (data: UpdatePostRequestInterface): UpdatePostRequestActionInterface => ({   type: UPDATE_POST_REQUEST,   payload: data });  export const updatePostSuccess = (data: UpdatePostSuccessResponseInterface): UpdatePostSuccessActionInterface => ({   type: UPDATE_POST_SUCCESS,   payload: data });  export const updatePostFailure = (error: string): UpdatePostFailureActionInterface => ({   type: UPDATE_POST_FAILURE,   payload: {     message: error   }, });  export const createPostRequest = (data: CreatePostRequestInterface): CreatePostRequestActionInterface => ({   type: CREATE_POST_REQUEST,   payload: data });  export const createPostSuccess = (data: CreatePostSuccessResponseInterface): CreatePostSuccessActionInterface => ({   type: CREATE_POST_SUCCESS,   payload: data });  export const createPostFailure = (error: string): CreatePostFailureActionInterface => ({   type: CREATE_POST_FAILURE,   payload: {     message: error   }, });  export const deletePostRequest = (data: DeletePostRequestInterface): DeletePostRequestActionInterface => ({   type: DELETE_POST_REQUEST,   payload: data });  export const deletePostSuccess = (data: {}): DeletePostSuccessActionInterface => ({   type: DELETE_POST_SUCCESS,   payload: data });  export const deletePostFailure = (error: string): DeletePostFailureActionInterface => ({   type: DELETE_POST_FAILURE,   payload: {     message: error   }, });  export const fetchPostsRequest = (): FetchPostsRequestActionInterface => ({   type: FETCH_POSTS_REQUEST, });  export const fetchPostsSuccess = (data: FetchPostsSuccessResponseInterface): FetchPostsSuccessActionInterface => ({   type: FETCH_POSTS_SUCCESS,   payload: data, });  export const fetchPostsFailure = (error: string): FetchPostsFailureActionInterface => ({   type: FETCH_POSTS_FAILURE,   payload: {     message: error   }, });<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u0433\u0434\u0430 actions \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 &#8212; \u043e\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 Redux store \u0447\u0435\u0440\u0435\u0437 <code>dispatch<\/code> \u043c\u0435\u0442\u043e\u0434. \u042d\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u00a0\u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 redux dispatch &#8212; \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u00a0action,\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442 \u043d\u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u00a0\u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p><code>dispatch(updatePostRequest(data));<\/code><\/p>\n<p>\u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/github.com\/adss332\/ReduxSagaTsBlog\/blob\/main\/src\/components\/pages\/posts\/PostsList.tsx\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u0443\u044e \u0432\u0441\u0435 \u0447\u0442\u043e \u043c\u043e\u0433\u0443 &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445. \u0411\u043b\u0438\u0436\u0435 \u043a \u043a\u043e\u043d\u0446\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u043f\u0438\u0448\u0443 \u0441\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0440\u0443\u0434\u0430. <\/p>\n<p><a class=\"anchor\" name=\"reducers\" id=\"reducers\"><\/a><\/p>\n<h2>3. Reducers<\/h2>\n<p>\u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u0432 \u044d\u0442\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435 Redux \u0438\u0433\u0440\u0430\u044e\u0442 \u0440\u043e\u043b\u044c &#171;\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445&#187; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. <\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0438\u0448\u043a\u0438 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u0432: <\/p>\n<ol>\n<li>\n<p><strong>\u0418\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432 \u043a\u043e\u0434\u0435. \u0418\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430 \u043f\u043e\u0441\u043b\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Switch Statements<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <a href=\"https:\/\/learn.javascript.ru\/switch\" rel=\"noopener noreferrer nofollow\">switch<\/a> \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 &#8212; \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044f\u0432\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0420\u0435\u0434\u044e\u0441\u0435\u0440\u0430<\/strong>: \u0420\u0435\u0434\u044e\u0441\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0447\u0438\u0441\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0432\u044b\u0432\u043e\u0434, \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c <strong>\u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432<\/strong> (\u0432\u043d\u0443\u0442\u0440\u044c \u043d\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0434\u043e \u043a\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u043e\u043c) .<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u043e\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u0435\u0440\u0445\u0443 \u043b\u0435\u0436\u0438\u0442 initial \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0434\u044e\u0441\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438, \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043e\u043d \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f &#8212; action. \u0412\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u0434\u044e\u0441\u0435\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/learn.javascript.ru\/switch\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u0438\u0442\u0447 \u043a\u0435\u0439\u0441<\/a> \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 &#8212; \u043e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. <\/p>\n<details class=\"spoiler\">\n<summary>src\/redux\/reducers\/postsReducer.ts<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>const initialState: PostsState = {   posts: [],   successMessage: null,   isLoading: false,   error: null, };  export const postsReducer = (state = initialState, action: PostsActions) => {   switch (action.type) {     case FETCH_POSTS_REQUEST:       return {         ...state,         isLoading: true,         successMessage: null,         error: null,       };     case FETCH_POSTS_SUCCESS:       return {         ...state,         isLoading: false,         posts: action.payload       };     case FETCH_POSTS_FAILURE:       return <\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-353294","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=353294"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353294\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}