{"id":317861,"date":"2021-02-11T15:01:07","date_gmt":"2021-02-11T15:01:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317861"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317861","title":{"rendered":"\u041a\u043e\u043c\u0443 \u0441 Redux \u0436\u0438\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043a\u0438! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0418\u0432\u0430\u0445\u0430, \u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0434\u0435\u0432-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0432 ManyChat. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0435\u0432-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c ManyChat \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438.<\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043b\u0438 \u043f\u043e \u043a\u0430\u043d\u043e\u043d\u0430\u043c <b>Test Driven Development (TDD)<\/b> \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0432\u0435\u043d\u0447\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0438\u0444 \u0438 \u043f\u043e\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u043e.<\/p>\n<p>  \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 <a href=\"https:\/\/reactjs.org\/\">React<\/a> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0436\u0435\u0448\u044c \u043f\u0440\u043e <a href=\"https:\/\/redux.js.org\/\">Redux<\/a>. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 React, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Redux, \u043f\u043e\u0439\u043c\u0451\u0442\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0434\u0435\u0431\u0430\u0433\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u0440\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0440\u043e\u043d\u0442\u043e\u0432\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xn\/k3\/0o\/xnk30oum9v04bbphe8qvdci4xv4.png\"><br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u043e TDD \u0432\u043e\u043e\u0431\u0449\u0435 \u0438 \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f React-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/habr.com\/ru\/company\/manychat\/blog\/528794\/\">\u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0438 \u0410\u043d\u0434\u0440\u0435\u044f<\/a>, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0437\u0430\u043e\u0441\u0442\u0440\u044f\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 \u043d\u044e\u0430\u043d\u0441\u0430\u0445, \u043d\u043e \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0439\u0434\u0443 \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>  \u041b\u044e\u0431\u043e\u0439 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0438 \u0441\u0432\u043e\u0439 \u0431\u044d\u043a\u0435\u043d\u0434. \u041f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443. React \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438, \u0430 Redux \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u043c\u044b \u0432 ManyChat \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2020 \u0433\u043e\u0434\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043d\u0430 <a href=\"https:\/\/www.typescriptlang.org\/\">TypeScript<\/a>, \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0440\u0430\u0437\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h3>Redux<\/h3>\n<p>  \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Redux? Redux \u2014 \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\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 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 Action. \u041e\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Redux \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 React, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wf\/is\/cs\/wfiscsvmf2kqw-lxw-bsx0bqssu.png\"><\/p>\n<p>  \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 DOM, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f Action creator, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 Action. \u042d\u0442\u043e\u0442 Action c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 Dispatch \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 Store, \u0433\u0434\u0435 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432 Reducers. \u0420\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u044b, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u044d\u043a\u0448\u0435\u043d\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 React \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Selectors \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0430 DOM. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 Redux \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435 \u043f\u043e \u0445\u043e\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u0451\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u2014 \u043e\u0441\u043b\u0430\u0431\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043e\u0434\u0438\u043d \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043b\u044e\u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0430<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u043e\u0440\u043c\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u0424\u043e\u0440\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0447\u0435\u043a\u0431\u043e\u043a\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 <b>Submit<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9h\/pf\/l1\/9hpfl1lkl-w4u0rhn7jdmotgeyu.png\"><\/p>\n<p>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c create-react-app:<\/p>\n<pre><code class=\"bash\">npx create-react-app my-app --template typescript cd my-app npm start<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438, \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mb\/0v\/_k\/mb0v_kkmg1x3xq5pk5tllqzh704.png\"><\/p>\n<p>  \u041c\u043e\u0436\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u0449\u0438\u043a, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043d\u0430\u043c \u0435\u0449\u0451 \u043e\u0447\u0435\u043d\u044c \u043d\u0435 \u0441\u043a\u043e\u0440\u043e. \u041c\u043e\u0436\u0435\u043c \u0434\u0430\u0436\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0432\u043a\u0443\u0441\u043d\u043e\u043c\u0443 \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e Redux \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442. \u0422.\u043a. \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443 \u043d\u0430\u0441 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043f\u0443\u0441\u0442\u043e\u0435, \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u0442\u043e\u0440\u0430, \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a. <\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<pre><code class=\"bash\">npm i redux react-redux redux-mock-store @types\/redux @types\/react-redux @types\/redux-mock-store  <\/code><\/pre>\n<p>  <\/p>\n<h3>Actions<\/h3>\n<p>  \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Action? \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Javascript \u043e\u0431\u044a\u0435\u043a\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <b>type<\/b>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u044d\u043a\u0448\u0435\u043d\u0430. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Redux \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 type \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 <b>\u0434\u043e\u043c\u0435\u043d\/\u0441\u043e\u0431\u044b\u0442\u0438\u0435<\/b>. \u0422\u0430\u043a\u0436\u0435 \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043e\u0431\u044b\u0447\u043d\u043e, \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <b>payload<\/b>. \u042d\u043a\u0448\u0435\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>Action Creators<\/b> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u044d\u043a\u0448\u0435\u043d\u044b.<\/p>\n<p>  \u0420\u0430\u0437 \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u044b, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043a\u0448\u0435\u043d\u0430, \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0435\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 <code>type<\/code>. <\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u0436\u0435 \u0441\u0442\u0430\u0432\u0448\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <a href=\"https:\/\/jestjs.io\/\">Jest<\/a>. \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u0441\u043b\u0435\u0434\u044f\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>npm test<\/code>.<\/p>\n<pre><code class=\"javascript\">\/\/ actions\/actions.test.ts  import { checkboxClick } from '.'  describe('checkboxClick', () =&gt; {   it('returns checkboxClick action with action name in payload', () =&gt; {     const checkboxName = 'anyCheckbox'      const result = checkboxClick(checkboxName)      expect(result).toEqual({ type: 'checkbox\/click', payload: checkboxName })   }) })<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, Action Creator \u0432\u0435\u0440\u043d\u0451\u0442 \u044d\u043a\u0448\u043d \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430. \u0418 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c.<\/p>\n<p>  \u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u0442\u0435\u0441\u0442 \u0443 \u043d\u0430\u0441 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 (\u0441\u043b\u043e\u043c\u0430\u043d\u043d\u044b\u0439), \u0442.\u043a. \u043a\u043e\u0434 \u0435\u0449\u0451 \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gr\/bp\/cv\/grbpcv_omlut26rri6mcylsfe90.png\"><\/p>\n<p>  \u041f\u043e\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">\/\/ actions\/package.json {   &quot;main&quot;: &quot;.\/actions&quot; }  \/\/ actions\/actions.ts export const checkboxClick = (name: string) =&gt; ({ type: 'checkbox\/click', payload: name })<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/db\/db\/ch\/dbdbchg07afpmhxe4a4rlftei5k.png\"><\/p>\n<p>  \u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d, \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0443. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u044f\u0432\u043d\u043e\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0441 \u0442\u0438\u043f\u043e\u043c \u044d\u043a\u0448\u0435\u043d\u0430, \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0435\u0451 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<pre><code class=\"javascript\">\/\/ actionTypes.ts  export const CHECKBOX_CLICK = 'checkbox\/click'<\/code><\/pre>\n<p>  \u041f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"javascript\">\/\/ actions\/actions.test.ts  import { CHECKBOX_CLICK } from 'actionTypes' import { checkboxClick } from '.'  describe('checkboxClick', () =&gt; {   it('returns checkboxClick action with action name in payload', () =&gt; {     const checkboxName = 'anyCheckbox'      const result = checkboxClick(checkboxName)      expect(result).toEqual({ type: CHECKBOX_CLICK, payload: checkboxName })   }) })<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a <code>actionTypes<\/code>. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>tsconfig.json<\/code> \u0432 \u0441\u0435\u043a\u0446\u0438\u044e <code>compilerOptions<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>&quot;baseUrl&quot;: &quot;src&quot;<\/code>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>  \u0423\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0442\u0435\u0441\u0442 \u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u043b, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u0441\u0430\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">\/\/ actions\/actions.ts  import { CHECKBOX_CLICK } from 'actionTypes'  export const checkboxClick = (name: string) =&gt; ({ type: CHECKBOX_CLICK, payload: name })<\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u0440\u0430\u0437 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u0438 \u043c\u043e\u0436\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h3>Reducers<\/h3>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430, \u0442.\u0435. <b>Reducer<\/b>. \u0420\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \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 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 <b>state<\/b> \u0438 <b>action<\/b>, \u0440\u0435\u0448\u0430\u044e\u0442 \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u043e\u0432\u044b\u0439 <b>state<\/b>. \u0420\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u044b <a href=\"https:\/\/redux.js.org\/style-guide\/style-guide#put-as-much-logic-as-possible-in-reducers\">\u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u044e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/a>, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. <\/p>\n<p>  \u0425\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u043e\u0432 (\u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u043e\u043d\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442) \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430, \u0430 \u0432 \u0431\u0443\u043b\u0435\u0432\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<pre><code class=\"javascript\">{   checkboxName: true }<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0442.\u0435. \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<pre><code class=\"javascript\">\/\/ reducers\/reducers.test.ts  import { checkboxReducer } from '.'  describe('checkboxReducer', () =&gt; {   it('creates default state', () =&gt; {     const state = checkboxReducer(undefined, { type: 'anyAction' })      expect(state).toEqual({})   }) })<\/code><\/pre>\n<p>  \u0422.\u043a. \u0443 \u043d\u0430\u0441 \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c, \u0442\u0435\u0441\u0442 \u0441\u043b\u043e\u043c\u0430\u043d. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">\/\/ reducers\/package.json  {   &quot;main&quot;: &quot;.\/reducers&quot; }  \/\/ reducers\/reducers.ts  const initialState: Record&lt;string, boolean&gt; = {}  export const checkboxReducer = (state = initialState, action: { type: string }) =&gt; {   return state }<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 \u043f\u043e\u0447\u0438\u043d\u0438\u043b\u0438, \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u043a\u0448\u0435\u043d\u0430 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u043d\u0430\u0436\u0430\u0442\u043e\u043c \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0435.<\/p>\n<pre><code class=\"javascript\">\/\/ reducers\/reducers.test.ts  import { CHECKBOX_CLICK } from 'actionTypes' import { checkboxReducer } from '.'  describe('checkboxReducer', () =&gt; {   it('creates default state', () =&gt; {     const state = checkboxReducer(undefined, { type: 'anyAction' })      expect(state).toEqual({})   })    it('sets checked flag', () =&gt; {     const state = checkboxReducer(undefined, { type: CHECKBOX_CLICK, payload: 'anyName' })      expect(state.anyName).toBe(true)   }) })<\/code><\/pre>\n<p>  \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">\/\/ reducers\/reducers.ts  import { CHECKBOX_CLICK } from 'actionTypes'  const initialState: Record&lt;string, boolean&gt; = {}  export const checkboxReducer = (   state = initialState,   action: { type: string; payload?: string }, ) =&gt; {   if (action.type === CHECKBOX_CLICK &amp;&amp; action.payload) {     return { ...state, [action.payload]: true }   }   return state }<\/code><\/pre>\n<p>  \u041c\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044d\u043a\u0448\u0435\u043d\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043c\u044f \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430, \u0432 <code>state<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043e\u0442\u043c\u0435\u0447\u0435\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u0447\u0435\u043a\u0431\u043e\u043a\u0441 \u0431\u044b\u043b \u043e\u0442\u043c\u0435\u0447\u0435\u043d, \u0442\u043e \u043e\u0442\u043c\u0435\u0442\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043d\u044f\u0442\u0430, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>false<\/b>.<\/p>\n<pre><code class=\"javascript\">\/\/ reducers\/reducers.test.ts    it('sets checked flag to false when it was checked', () =&gt; {     const state = checkboxReducer({ anyName: true }, { type: CHECKBOX_CLICK, payload: 'anyName' })      expect(state.anyName).toBe(false)   })<\/code><\/pre>\n<p>  \u0423\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0442\u0435\u0441\u0442 \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u0442.\u043a. \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 <code>true<\/code>, \u0432\u0435\u0434\u044c \u0434\u043e \u0441\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u044b\u043b\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u043a\u043e\u0434\u0443. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u044d\u0442\u043e.<\/p>\n<pre><code class=\"javascript\">\/\/ reducers\/reducers.ts  import { CHECKBOX_CLICK } from 'actionTypes'  const initialState: Record&lt;string, boolean&gt; = {}  export const checkboxReducer = (   state = initialState,   action: { type: string; payload?: string }, ) =&gt; {   if (action.type === CHECKBOX_CLICK &amp;&amp; action.payload) {     return { ...state, [action.payload]: !state[action.payload] }   }   return state }<\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u0438\u043c \u0442\u0435\u0441\u0442\u0430\u043c \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442.<\/p>\n<h3>Selectors<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <b>Selector<\/b>. \u0421\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043c\u0435\u044e\u0442 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440.<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u0434\u043b\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430.<\/p>\n<pre><code class=\"javascript\">\/\/ selectors\/selectors.test.ts  import { getCheckboxState } from '.\/selectors'  describe('getCheckboxState', () =&gt; {   const state = {     checkboxes: { anyName: true },   }    it('returns current checkbox state', () =&gt; {     const result = getCheckboxState('anyName')(state)      expect(result).toBe(true)   }) })<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u00ab\u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u0442\u044c\u00bb.<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"javascript\">\/\/ types.ts  export type State = {   checkboxes: Record&lt;string, boolean&gt; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430. \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0441\u0448\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0438\u0437-\u0437\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0445\u0443\u043a\u0430 <code>useSelector<\/code> \u043f\u0430\u043a\u0435\u0442\u0430 <code>react-redux<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0443\u044e \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u0430, \u0430 \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0435\u0449\u0451 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430.<\/p>\n<pre><code class=\"javascript\">\/\/ selectors\/package.json  {   &quot;main&quot;: &quot;.\/selectors&quot; }  \/\/ selectors\/selectors.ts  import { State } from 'types'  export const getCheckboxState = (name: string) =&gt; (state: State) =&gt; state.checkboxes[name]<\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043c\u044b \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u0435\u0441\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0435\u043b\u0451\u043d\u044b\u0439. \u041d\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0449\u0451 \u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430? \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0435\u0441\u0442.<\/p>\n<pre><code class=\"javascript\">\/\/ selectors\/selectors.test.ts    it('returns false when checkbox state is undefined', () =&gt; {     const result = getCheckboxState('anotherName')(state)      expect(result).toBe(false)   })<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mr\/tb\/aq\/mrtbaqz-nzh6b-eyhmkp8tp1wva.png\"><\/p>\n<p>  \u0418 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 <code>undefined<\/code>, \u0442.\u0435. state \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0435. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">\/\/ selectors\/selectors.ts  import { State } from 'types'  export const getCheckboxState = (name: string) =&gt; (state: State) =&gt; state.checkboxes[name] ?? false<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043a\u0430\u043a \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<h3>Store<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0430\u043c <b>Store<\/b>, \u0442.\u0435. \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Redux, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"javascript\">\/\/ store.ts  import { AnyAction, createStore, combineReducers } from 'redux' import { State } from 'types' import { checkboxReducer } from 'reducers'  export const createAppStore = (initialState?: State) =&gt;   createStore&lt;State, AnyAction, unknown, unknown&gt;(     combineReducers({       checkboxes: checkboxReducer,     }),     initialState,   )  export default createAppStore()<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0442.\u043a. \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430. \u041d\u043e \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0432\u0441\u044e \u0441\u0432\u044f\u0437\u043a\u0443 React + Redux.<\/p>\n<h3>React Components<\/h3>\n<p>  \u0422.\u043a. \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443 \u043c\u044b \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043b\u0438, \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0441\u043b\u043e\u044e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432. \u0412 \u043d\u0435\u0439 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0435\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430, \u043d\u043e \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0432\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <code>react-test-renderer<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 DOM, \u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0435\u0433\u043e JS \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0430\u043a\u0435\u0442:<\/p>\n<pre><code class=\"bash\">npm i react-test-renderer @types\/react-test-renderer<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b. \u041d\u0430\u0447\u043d\u0451\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430.<\/p>\n<h3>Checkbox<\/h3>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx  import { create } from 'react-test-renderer' import Checkbox from '.'  describe('Checkbox', () =&gt; {   it('renders checkbox input', () =&gt; {     const checkboxName = 'anyName'      const renderer = create(&lt;Checkbox \/&gt;)      const element = renderer.root.findByType('input')     expect(element.props.type).toBe('checkbox')   }) })<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 <code>Checkbox<\/code> \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 <code>input<\/code> \u0441 \u0442\u0438\u043f\u043e\u043c <code>checkbox<\/code>.<\/p>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u0437\u0435\u043b\u0451\u043d\u044b\u043c.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/package.json  {   &quot;main&quot;: &quot;Checkbox&quot; }  \/\/ components\/Checkbox\/Checkbox.tsx  import React from 'react'  const Checkbox: React.FC = () =&gt; {   return (     &lt;div&gt;       &lt;input type=&quot;checkbox&quot; \/&gt;     &lt;\/div&gt;   ) }  export default Checkbox<\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>label<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f html \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <code>label<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0440\u044f\u0434\u043e\u043c \u0441 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u043e\u043c.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx  it('renders label', () =&gt; {     const labelText = 'anyLabel'      const renderer = create(&lt;Checkbox label={labelText} \/&gt;)      const element = renderer.root.findByType('label')     expect(element.props.children).toBe(labelText)   })<\/code><\/pre>\n<p>  \u0417\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0442\u0438.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.tsx  const Checkbox: React.FC&lt;{ label: string }&gt; = ({ label }) =&gt; {   return (     &lt;div&gt;       &lt;input type=&quot;checkbox&quot; \/&gt;       &lt;label&gt;{label}&lt;\/label&gt;     &lt;\/div&gt;   ) }<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c \u2014 \u0447\u0435\u043a\u0431\u043e\u043a\u0441 \u043a\u0430\u043a-\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0435\u0431\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043b\u0438\u043a\u0430 \u043f\u043e <code>label<\/code>, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c id \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>htmlFor<\/code>. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 id:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx    it('sets name prop as input id', () =&gt; {     const checkboxName = 'anyCheckbox'      const renderer = create(&lt;Checkbox name={checkboxName} label={'anyLabel'} \/&gt;)      const element = renderer.root.findByType('input')     expect(element.props.id).toBe(checkboxName)   })<\/code><\/pre>\n<p>  \u0423\u0431\u0435\u0434\u0438\u0432\u0448\u0438\u0441\u044c, \u0447\u0442\u043e \u043e\u043d \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.tsx  const Checkbox: React.FC&lt;{ name: string; label: string }&gt; = ({ name, label }) =&gt; {   return (     &lt;div&gt;       &lt;input id={name} type=&quot;checkbox&quot; \/&gt;       &lt;label&gt;{label}&lt;\/label&gt;     &lt;\/div&gt;   ) }<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u0437\u0435\u043b\u0435\u043d\u044b\u0439, \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 name \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>htmlFor<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <code>label<\/code>.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx    it('sets name prop as label htmlFor', () =&gt; {     const checkboxName = 'anyCheckbox'      const renderer = create(&lt;Checkbox name={checkboxName} label={'anyLabel'} \/&gt;)      const element = renderer.root.findByType('label')     expect(element.props.htmlFor).toBe(checkboxName)   })<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.tsx  const Checkbox: React.FC&lt;{ name: string; label: string }&gt; = ({ name, label }) =&gt; {   return (     &lt;div&gt;       &lt;input id={name} type=&quot;checkbox&quot; \/&gt;       &lt;label htmlFor={name}&gt;{label}&lt;\/label&gt;     &lt;\/div&gt;   ) }<\/code><\/pre>\n<p>  \u041f\u043e\u0440\u0430 \u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c Store \u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430 (\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>checked<\/code>) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 Store.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx  import { Provider } from 'react-redux' import { create } from 'react-test-renderer' import { createAppStore } from 'store' import Checkbox from '.'  \/\/ omit old code    it('sets checked flag from store when it`s checked', () =&gt; {     const store = createAppStore({ checkboxes: { anyName: true } })      const renderer = create(       &lt;Provider store={store}&gt;         &lt;Checkbox name=&quot;anyName&quot; label=&quot;anyLabel&quot; \/&gt;       &lt;\/Provider&gt;,     )      const element = renderer.root.findByType('input')     expect(element.props.checked).toBe(true)   })<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u043f\u043e\u043a\u0430 \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u0442.\u043a. \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043e \u0441\u0442\u043e\u0440\u0435. \u0417\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442 \u00ab\u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u0442\u044c\u00bb.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.tsx  import React from 'react' import { useSelector } from 'react-redux' import { getCheckboxState } from 'selectors'  const Checkbox: React.FC&lt;{ name: string; label: string }&gt; = ({ name, label }) =&gt; {   const checked = useSelector(getCheckboxState(name))    return (     &lt;div&gt;       &lt;input id={name} type=&quot;checkbox&quot; checked={checked} \/&gt;       &lt;label htmlFor={name}&gt;{label}&lt;\/label&gt;     &lt;\/div&gt;   ) }  export default Checkbox<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d. \u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e, \u043c\u044b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 Redux! \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 <code>getCheckboxState<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0445\u0443\u043a\u0430 <code>useSelector<\/code>, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>checked<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <code>input<\/code>. \u041d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u0441\u043b\u043e\u043c\u0430\u043b\u0438\u0441\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/h-\/4k\/1h\/h-4k1hwb2ga2znewznbhpifhkhe.png\"><\/p>\n<p>  \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u0435\u0435 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u043c\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u0441\u0442\u043e\u0440 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0412\u044b\u0434\u0435\u043b\u0438\u043c \u0447\u0430\u0441\u0442\u044c \u0441 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c \u0441\u0442\u043e\u0440\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx  import { ReactElement } from 'react' import { Provider } from 'react-redux' import { create } from 'react-test-renderer' import { createAppStore } from 'store' import { State } from 'types' import Checkbox from '.'  export const renderWithRedux = (node: ReactElement, initialState: State = { checkboxes: {} }) =&gt; {   const store = createAppStore(initialState)    return create(&lt;Provider store={store}&gt;{node}&lt;\/Provider&gt;) }  describe('Checkbox', () =&gt; {   it('renders checkbox input', () =&gt; {     const checkboxName = 'anyName'      const renderer = renderWithRedux(&lt;Checkbox \/&gt;)      const element = renderer.root.findByType('input')     expect(element.props.type).toBe('checkbox')   })    it('renders label', () =&gt; {     const labelText = 'anyLabel'      const renderer = renderWithRedux(&lt;Checkbox label={labelText} \/&gt;)      const element = renderer.root.findByType('label')     expect(element.props.children).toBe(labelText)   })    it('sets name prop as input id', () =&gt; {     const checkboxName = 'anyCheckbox'      const renderer = renderWithRedux(&lt;Checkbox name={checkboxName} label={'anyLabel'} \/&gt;)      const element = renderer.root.findByType('input')     expect(element.props.id).toBe(checkboxName)   })    it('sets name prop as label htmlFor', () =&gt; {     const checkboxName = 'anyCheckbox'      const renderer = renderWithRedux(&lt;Checkbox name={checkboxName} label={'anyLabel'} \/&gt;)      const element = renderer.root.findByType('label')     expect(element.props.htmlFor).toBe(checkboxName)   })    it('sets checked flag from store when it`s checked', () =&gt; {     const initialState = { checkboxes: { anyName: true } }      const renderer = renderWithRedux(&lt;Checkbox name=&quot;anyName&quot; label=&quot;anyLabel&quot; \/&gt;, initialState)      const element = renderer.root.findByType('input')     expect(element.props.checked).toBe(true)   }) })<\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>renderWithRedux<\/b> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439, \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0435\u0451 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u0442\u0435\u0441\u0442\u0430\u0445. <\/p>\n<pre><code class=\"javascript\">\/\/ utils.tsx  import { ReactElement } from 'react' import { Provider } from 'react-redux' import { create } from 'react-test-renderer' import { Store } from '.\/types' import { createAppStore } from '.\/store'  export const renderWithRedux = (node: ReactElement, initialState: Store = { checkboxes: {} }) =&gt; {   const store = createAppStore(initialState)    return create(&lt;Provider store={store}&gt;{node}&lt;\/Provider&gt;) }<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0448\u0430\u043f\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx  import { renderWithRedux } from 'utils' import Checkbox from '.'  describe('Checkbox', () =&gt; {<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442, \u0447\u0442\u043e <code>checked<\/code> \u0431\u044b\u0432\u0430\u0435\u0442 \u0438 <code>false<\/code>.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx    it('sets checked flag from store when it`s unchecked', () =&gt; {     const initialState = { checkboxes: { anyName: false } }      const renderer = renderWithRedux(&lt;Checkbox name=&quot;anyName&quot; label=&quot;anyLabel&quot; \/&gt;, initialState)      const element = renderer.root.findByType('input')     expect(element.props.checked).toBe(false)   })<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d, \u043d\u043e \u0443 \u043d\u0430\u0441 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430 \u0441 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0447\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx    test.each`     storedState | state     ${true}     | ${'checked'}     ${false}    | ${'unchecked'}   `('sets checked flag from store when it`s $state', ({ storedState }) =&gt; {     const initialState = { checkboxes: { anyName: storedState } }      const renderer = renderWithRedux(&lt;Checkbox name=&quot;anyName&quot; label=&quot;anyLabel&quot; \/&gt;, initialState)      const element = renderer.root.findByType('input')     expect(element.props.checked).toBe(storedState)   })<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0443\u0436\u0435 \u043b\u0443\u0447\u0448\u0435. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u043a\u0443\u0441\u043d\u043e\u0435 \u2014 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u0447\u0435\u043a\u0431\u043e\u043a\u0441, \u043e\u043d \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u0432\u043e\u0451 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0442.\u0435. \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <b>checked<\/b>.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.test.tsx  import { act } from 'react-test-renderer'  \/\/ omit old code      it('changes it`s checked state when it`s clicked', () =&gt; {     const initialState = { checkboxes: { anyName: false } }     const renderer = renderWithRedux(&lt;Checkbox name=&quot;anyName&quot; label=&quot;anyLabel&quot; \/&gt;, initialState)     const element = renderer.root.findByType('input')      act(() =&gt; {       element.props.onChange()     })      expect(element.props.checked).toBe(true)   })<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>act<\/code>, \u043f\u0430\u043a\u0435\u0442\u0430 <code>react-test-renderer<\/code>, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043a\u043e\u0442\u043e\u0440\u0443\u044e, \u043c\u044b \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0438 \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0418 \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>onChange<\/code> \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0435, \u043e\u043d \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>checked<\/code> \u043d\u0430 <code>true<\/code>. \u041f\u043e\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434. \u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434.<\/p>\n<pre><code class=\"javascript\">\/\/ components\/Checkbox\/Checkbox.tsx  import React from 'react' import { useDispatch, useSelector } from 'react-redux' import { getCheckboxState } from 'selectors' import { checkboxClick } from 'actions'  const Checkbox: React.FC&lt;{ name: string; label: string }&gt; = ({ name, label }) =&gt; {   const dispatch = useDispatch()   const checked = useSelector(getCheckboxState(name))    const handleClick = React.useCallback(() =&gt; {     dispatch(checkboxClick(name))   }, [dispatch, name])    return (     &lt;div&gt;       &lt;input id={name} type=&quot;checkbox&quot; checked={checked} onChange={handleClick} \/&gt;       &lt;label htmlFor={name}&gt;{label}&lt;\/label&gt;     &lt;\/div&gt;   ) }  export default Checkbox<\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u0434\u0435 \u043c\u044b \u043d\u0430\u0432\u0435\u0441\u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>change<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 action \u0432 store, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>checkboxClick<\/code>. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0442\u0435\u0441\u0442 \u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u043b. \u041d\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0439 \u0432 Redux.<\/p>\n<h3>AgreementSubmitButton<\/h3>\n<p>  \u041d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u2014 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043d\u043e\u043f\u043a\u0430 Submit, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/AgreementSubmitButton\/AgreementSubmitButton.test.tsx  import { renderWithRedux } from 'utils' import AgreementSubmitButton from '.'  describe('AgreementSubmitButton', () =&gt; {   it('renders button with label Submit', () =&gt; {     const renderer = renderWithRedux(&lt;AgreementSubmitButton \/&gt;)      const element = renderer.root.findByType('input')     expect(element.props.type).toBe('button')     expect(element.props.value).toBe('Submit')   }) })<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442 \u00ab\u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u0442\u044c\u00bb:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/AgreementSubmitButton\/package.json {   &quot;main&quot;: &quot;.\/AgreementSubmitButton&quot; }  \/\/ components\/AgreementSubmitButton\/AgreementSubmitButton.tsx import React from 'react'  const AgreementSubmitButton: React.FC = () =&gt; {   return &lt;input type=&quot;button&quot; value=&quot;Submit&quot; \/&gt; }  export default AgreementSubmitButton<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u0437\u0435\u043b\u0451\u043d\u044b\u0439, \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0442\u0435\u0441\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <b>disabled<\/b> \u043d\u043e\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430. \u0422.\u043a. \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0432\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0432\u043d\u043e\u0432\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/AgreementSubmitButton\/AgreementSubmitButton.test.tsx    test.each`     checkboxState | disabled | agreementState     ${false}      | ${true}  | ${'not agreed'}     ${true}       | ${false} | ${'agreed'}   `(     'render button with disabled=$disabled when agreement is $agreementState',     ({ checkboxState, disabled }) =&gt; {       const initialState = { checkboxes: { agree: checkboxState } }        const renderer = renderWithRedux(&lt;AgreementSubmitButton \/&gt;, initialState)        const element = renderer.root.findByType('input')       expect(element.props.disabled).toBe(disabled)     },   )<\/code><\/pre>\n<p>  \u0418\u043c\u0435\u0435\u043c \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/AgreementSubmitButton\/AgreementSubmitButton.tsx  import React from 'react' import { useSelector } from 'react-redux' import { getCheckboxState } from 'selectors\/selectors'  const AgreementSubmitButton: React.FC = () =&gt; {   const checkboxName = 'agree'   const agreed = useSelector(getCheckboxState(checkboxName))    return &lt;input type=&quot;button&quot; value=&quot;Submit&quot; disabled={!agreed} \/&gt; }  export default AgreementSubmitButton<\/code><\/pre>\n<p>  \u0423\u0440\u0430, \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0437\u0435\u043b\u0451\u043d\u044b\u0435! <\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0435 \u043c\u044b \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>checkboxState<\/code> \u0438 <code>disabled<\/code>, \u0445\u043e\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0430 \u0432 \u0442\u0435\u0441\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a <code><b>expect(element.props.disabled).toBe(!disabled)<\/b><\/code>. \u041d\u043e \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u2014 \u0437\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0441\u0442\u043e\u0432. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u044f\u0432\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u0422\u0430\u043a \u0436\u0435, \u043c\u044b \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0438\u0441\u044c, \u0442.\u043a., \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430 \u0437\u0430 \u0440\u0430\u0437. \u0422\u0430\u043a\u043e\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u043a\u043e\u0433\u0434\u0430 \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0448\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u0438\u043b\u044b \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f. \u041a\u043e\u0433\u0434\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u044f TDD \u0435\u0449\u0451 \u043d\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0439, \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0443 \u0437\u0430 \u0440\u0430\u0437. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u044d\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<h3>LicenseAgreement<\/h3>\n<p>  \u041e\u0444\u043e\u0440\u043c\u0438\u043c \u043d\u0430\u0448\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0442\u043e, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u043c\u044b \u0432\u0441\u0451 \u044d\u0442\u043e \u0437\u0430\u0442\u0435\u0432\u0430\u043b\u0438 \u2014 \u0432 \u0444\u043e\u0440\u043c\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u041a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0444\u043e\u0440\u043c\u0435:<\/p>\n<ol>\n<li>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0442\u0435\u043a\u0441\u0442 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u042d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li>\u041d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>Checkbox<\/code> \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 <code>label<\/code> \u0438 <code>name<\/code>. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/li>\n<li>\u041d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430 <code>AgreementSubmitButton<\/code>. \u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u0434\u0434\u0430\u0451\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e.<\/li>\n<\/ol>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c, \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0435\u0441\u0442\u044c <code>Checkbox<\/code>:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/LicenseAgreement\/LicenseAgreement.test.tsx  import { renderWithRedux } from 'utils' import Checkbox from 'components\/Checkbox' import LicenseAgreement from '.'  jest.mock('components\/Checkbox', () =&gt; () =&gt; null)  describe('LicenseAgreement', () =&gt; {   it('renders Checkbox with name and label', () =&gt; {     const renderer = renderWithRedux(&lt;LicenseAgreement \/&gt;)      const element = renderer.root.findByType(Checkbox)     expect(element.props.name).toBe('agree')     expect(element.props.label).toBe('Agree')   }) })<\/code><\/pre>\n<p>  \u041d\u0430 \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u0443\u0431\u043b\u0451\u0440 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 <code>Checkbox<\/code> \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 <code>jest.mock('components\/Checkbox', () =&gt; () =&gt; null)<\/code>. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0430\u0448 \u0442\u0435\u0441\u0442 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>Checkbox<\/code>, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u043d\u0435 \u043f\u043e\u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432. \u0422\u0435\u0441\u0442 \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/LicenseAgreement\/package.json {   &quot;main&quot;: &quot;.\/LicenseAgreement&quot; }  \/\/ src\/components\/LicenseAgreement\/LicenseAgreement.tsx import React from 'react' import Checkbox from 'components\/Checkbox'  const LicenseAgreement: React.FC = () =&gt; {   return (     &lt;div&gt;       &lt;Checkbox name=&quot;agree&quot; label=&quot;Agree&quot; \/&gt;     &lt;\/div&gt;   ) }  export default LicenseAgreement<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0424\u0430\u0439\u043b \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"javascript\">\/\/ components\/LicenseAgreement\/LicenseAgreement.test.tsx   import { renderWithRedux } from 'utils' import Checkbox from 'components\/Checkbox' import AgreementSubmitButton from 'components\/AgreementSubmitButton' import LicenseAgreement from '.'  jest.mock('components\/Checkbox', () =&gt; () =&gt; null) jest.mock('components\/AgreementSubmitButton', () =&gt; () =&gt; null)  describe('LicenseAgreement', () =&gt; {   it('renders Checkbox with name and label', () =&gt; {     const renderer = renderWithRedux(&lt;LicenseAgreement \/&gt;)      const element = renderer.root.findByType(Checkbox)     expect(element.props.name).toBe('agree')     expect(element.props.label).toBe('Agree')   })    it('renders SubmitAgreementButton', () =&gt; {     const renderer = renderWithRedux(&lt;LicenseAgreement \/&gt;)      expect(() =&gt; renderer.root.findByType(AgreementSubmitButton)).not.toThrow()   }) })<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u043b, \u0434\u043e\u0431\u0430\u0432\u0438\u043c <code>AgreementSubmitButton<\/code> \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442:<\/p>\n<pre><code class=\"javascript\">\/\/ src\/components\/LicenseAgreement\/LicenseAgreement.tsx  import React from 'react' import Checkbox from 'components\/Checkbox' import AgreementSubmitButton from 'components\/AgreementSubmitButton'  const LicenseAgreement: React.FC = () =&gt; {   return (     &lt;div&gt;       &lt;Checkbox name=&quot;agree&quot; label=&quot;Agree&quot; \/&gt;       &lt;AgreementSubmitButton \/&gt;     &lt;\/div&gt;   ) }  export default LicenseAgreement<\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e <code>Checkbox<\/code> \u0438 <code>AgreementSubmitButton<\/code> \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0441\u0442\u043e\u0440\u0430 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438 \u043e\u0442 \u0447\u0435\u0433\u043e.<\/p>\n<h3>\u041a\u043b\u044e\u0447 \u043d\u0430 \u0441\u0442\u0430\u0440\u0442!<\/h3>\n<p>  \u0412\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430\u0434 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0430\u043c \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f, \u0434\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0412 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>App<\/code>, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0435\u043d\u0434\u0435\u0440\u0430 <code>LicenseAgreement<\/code>:<\/p>\n<pre><code class=\"javascript\">\/\/ App.test.tsx  import { renderWithRedux } from 'utils' import LicenseAgreement from 'components\/LicenseAgreement' import App from 'App'  jest.mock('components\/LicenseAgreement', () =&gt; () =&gt; null)  test('renders LicenseAgreement', () =&gt; {   const renderer = renderWithRedux(&lt;App \/&gt;)    expect(() =&gt; renderer.root.findByType(LicenseAgreement)).not.toThrow() })<\/code><\/pre>\n<p>  \u0417\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0435\u0441\u0442 \u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">\/\/ App.tsx  import React from 'react' import LicenseAgreement from 'components\/LicenseAgreement'  const App: React.FC = () =&gt; {   return &lt;LicenseAgreement \/&gt; }  export default App<\/code><\/pre>\n<p>  \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0437\u0435\u043b\u0451\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>npm start<\/code>. \u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u043d\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4y\/yp\/i8\/4yypi8yheit63m-5rprm1sl0de8.png\"><\/p>\n<p>  \u042d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 Redux store \u0432 \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 <code>index.tsx<\/code>:<\/p>\n<pre><code class=\"javascript\">\/\/ index.tsx  import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import 'index.css' import store from 'store' import App from 'App'  ReactDOM.render(   &lt;React.StrictMode&gt;     &lt;Provider store={store}&gt;       &lt;App \/&gt;     &lt;\/Provider&gt;   &lt;\/React.StrictMode&gt;,   document.getElementById('root'), )<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u043a\u0440\u043e\u043c\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gc\/gl\/ly\/gcgllyzevtnf_xcw8aowkb6qhem.png\"><\/p>\n<p>  \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u044d\u0442\u043e, \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0432 \u0432\u0451\u0440\u0441\u0442\u043a\u0443, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bk\/qq\/q_\/bkqqq_pjys9cyul1lxjchbopgiu.gif\"><\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u042f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0438 \u043a\u043e\u0434\u043e\u043c. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 Redux, \u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u0430 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0435\u0439\u0442\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0438 \u043d\u0430 \u043c\u0435\u043b\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u043e. \u041d\u043e \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 Redux \u0431\u0443\u0434\u0443\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. Redux \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0447\u0435\u0440\u0435\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043b\u0438\u0431\u043e \u0434\u043e\u0441\u0442\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0441\u0442\u043e\u0440\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043b\u0438\u0431\u043e \u0441\u0430\u043c \u0436\u0435 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0438\u0442 \u044d\u043a\u0448\u0435\u043d\u044b.<\/p>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0441\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Redux Tookilt, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Redux \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0445\u043e\u0442\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u043d\u0430 React, Redux \u0438 Redux Toolkit.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/ivahaev\/redux-article-app\">GitHub<\/a>.<\/p>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li><a href=\"https:\/\/redux.js.org\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 Redux<\/a><\/li>\n<li><a href=\"https:\/\/redux.js.org\/style-guide\/style-guide\">Best practice \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Redux<\/a><\/li>\n<li><a href=\"https:\/\/jestjs.io\/\">\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f JS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Jest<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/manychat\/blog\/528794\/\">\u0425\u0430\u0431\u0440\u0430\u0441\u0442\u0430\u0442\u044c\u044f \u0410\u043d\u0434\u0440\u0435\u044f \u0425\u0438\u0436\u043d\u044f\u043a\u0430 REACT + JEST = TDD \ufe0f\ufe0f<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \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\/company\/manychat\/blog\/541794\/\"> https:\/\/habr.com\/ru\/company\/manychat\/blog\/541794\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043a\u0438! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0418\u0432\u0430\u0445\u0430, \u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0434\u0435\u0432-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0432 ManyChat. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0435\u0432-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c ManyChat \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438.<\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043b\u0438 \u043f\u043e \u043a\u0430\u043d\u043e\u043d\u0430\u043c <b>Test Driven Development (TDD)<\/b> \u0434\u043b\u044f \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0432\u0435\u043d\u0447\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0438\u0444 \u0438 \u043f\u043e\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u043e.<\/p>\n<p>  \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 <a href=\"https:\/\/reactjs.org\/\">React<\/a> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0436\u0435\u0448\u044c \u043f\u0440\u043e <a href=\"https:\/\/redux.js.org\/\">Redux<\/a>. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 React, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Redux, \u043f\u043e\u0439\u043c\u0451\u0442\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0434\u0435\u0431\u0430\u0433\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u0440\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0440\u043e\u043d\u0442\u043e\u0432\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xn\/k3\/0o\/xnk30oum9v04bbphe8qvdci4xv4.png\">  <\/p>\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-317861","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317861","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=317861"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317861\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}