{"id":326896,"date":"2022-01-10T08:40:54","date_gmt":"2022-01-10T08:40:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=326896"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=326896","title":{"rendered":"<span>Whoosh \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 React<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\" class=\"article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u043c. \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u043c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 React, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 <code>createShared()<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"\/img\/image-loader.svg\" data-src=\"https:\/\/habrastorage.org\/webt\/pu\/bc\/jd\/pubcjdq4fszxewd8makwqsuvuqo.png\"\/><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/AlexIII\/whoosh\" rel=\"nofollow noopener noreferrer\">GitHub \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<blockquote><p><strong><em>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/em><\/strong><br \/>  <em>\u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0446\u0435\u043b\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u2014 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0444\u0438\u0434\u0431\u0435\u043a \u0438 \u043c\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043b\u043e\u0442\u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0445 \u0441 \u0443\u0441\u0442\u043e\u044f\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0444\u0438\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0432\u0430\u043c\u0438 \u0441\u0442\u0435\u0439\u0442-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0432\u044b \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0446\u0435\u043d\u0438\u0442\u0435.<\/em><br \/>  <em>\u0422\u0430\u043a\u0436\u0435 \u0430\u0432\u0442\u043e\u0440 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u2014 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0441\u0432\u043e\u0435, \u0434\u043e\u043b\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0441 \u0442\u0435\u043c \u0447\u0442\u043e \u0435\u0441\u0442\u044c. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0432\u0430\u0448\u0443 \u0441\u043d\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c =)<\/em><\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"zachem\">\u0417\u0430\u0447\u0435\u043c<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u044b \u043b\u0435\u0442 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c: ~160 \u0444\u0430\u0439\u043b\u043e\u0432, \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u043e 100 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432 \u2014 React \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u0443\u043a\u043e\u0432 (hook) \u0432 React, \u0442\u0430\u043a \u0447\u0442\u043e 99.9% \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0443 \u043d\u0430\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 &#171;\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435&#187;.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u042f \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u043e\u043d\u0438 &#171;\u043d\u0435 \u043d\u0443\u0436\u043d\u044b&#187;. \u0418, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u044f\u0445 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0435\u0448\u0430\u043b\u0438\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0432\u044f\u0437\u043a\u0438 <code>useState<\/code> + \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u043a\u0430 \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 (\u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0443\u0436\u0435\u043d \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 &#171;\u0443\u0433\u043e\u043b\u043a\u043e\u0432 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0439&#187;) \u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 10. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439, \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c. \u0412 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441\u0442\u0435\u0439\u0442-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u0441 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 react \u043d\u0430 <a href=\"https:\/\/github.com\/preactjs\/preact\" rel=\"nofollow noopener noreferrer\">preact<\/a>. \u041a\u0430\u043a \u0436\u0435 \u044f \u0432\u043e\u0441\u0445\u0438\u0449\u0435\u043d \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c! \u041f\u043e\u043b\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 react (\u0435\u0449\u0435 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438) \u043c\u0435\u043d\u0435\u0435, \u0447\u0435\u043c \u0437\u0430 10\u043a\u0431. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e. \u042f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 preact \u043a\u0430\u043a \u043d\u0430 \u043e\u0431\u0440\u0430\u0437\u0435\u0446 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0442\u0435\u0439\u0442-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441 preact \u0435\u0433\u043e \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c).<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 API.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/AlexIII\/whoosh\" rel=\"nofollow noopener noreferrer\">\u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/AlexIII\/whoosh\/blob\/main\/tldr.md\" rel=\"nofollow noopener noreferrer\">TL;DR \u0432\u0435\u0440\u0441\u0438\u044e<\/a>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"ustanovka\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<p><code>npm install --save whoosh-react<\/code><\/p>\n<p>  <\/p>\n<h2 id=\"primery\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n<p>  <\/p>\n<h3 id=\"prostoy-schetchik\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0447\u0435\u0442\u0447\u0438\u043a<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/whoosh-counter-simple-yejzt?file=\/src\/App.tsx\" rel=\"nofollow noopener noreferrer\">\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 codesandbox.io<\/a><\/p>\n<p>  <\/p>\n<p>1\uff61 \u0421\u043e\u0437\u0434\u0430\u0435\u043c Shared State<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ AppState.ts import { createShared } from 'whoosh-react';  export const appCounter = createShared&lt;number>(0);<\/code><\/pre>\n<p>  <\/p>\n<p><code>createShared()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 Shared State.<\/p>\n<p>  <\/p>\n<p>2\uff61 \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Shared State \u0432 React \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ Counter.tsx import { appCounter } from '.\/AppState.ts';  const CounterValue = () => {     const counter = appCounter.use();     return &lt;p> { counter } &lt;\/p>; };  const CounterControls = () => {     const reset = () => appCounter.set(0);     const addOne = () => appCounter.set(previousValue => previousValue + 1);     return (&lt;>         &lt;button onClick={reset} > Reset &lt;\/button>         &lt;button onClick={addOne} > Add 1 &lt;\/button>     &lt;\/>); };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0447\u043b\u0435\u043d\u0430 Shared State:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p><code>use()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Shared State.<br \/>  \u042d\u0442\u043e React \u0445\u0443\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0440\u0435-\u0440\u0435\u043d\u0434\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 Shared State.<\/p>\n<p>  <\/li>\n<li>\n<p><code>set()<\/code> \u2014 \u043e\u0431\u044b\u0447\u043d\u0430\u044f JS \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Shared State. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043b\u0438\u0431\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0443\u044e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0443\u044e \u043d\u043e\u0432\u043e\u0435.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>3\uff61 \u0420\u0435\u043d\u0434\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 React \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const RootComponent = () => (     &lt;>         &lt;A>             &lt;CounterValue\/>         &lt;\/A>         &lt;B>             &lt;CounterControls\/>         &lt;\/B>     &lt;\/> );<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"schetchik-s-redyuserom-reducer\">\u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0441 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c (reducer)<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/whoosh-counter-reducer-4kwrn?file=\/src\/App.tsx\" rel=\"nofollow noopener noreferrer\">\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 codesandbox.io<\/a><\/p>\n<p>  <\/p>\n<p><code>createShared()<\/code> \u0438\u043c\u0435\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0442\u0438\u043f\u0430 <code>(previousValue: S, input: A) => S<\/code> \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0438\u0437 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <code>previousValue<\/code> \u0442\u0438\u043f\u0430 <code>S<\/code> \u0432 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0442\u043e\u0436\u0435 \u0442\u0438\u043f\u0430 <code>S<\/code>) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>input<\/code> \u0442\u0438\u043f\u0430 <code>A<\/code>. \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445 <code>input<\/code> \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <em>action<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>input<\/code> \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u0432 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set(input)<\/code> \u043f\u0440\u0438 \u0435\u0435 \u0432\u044b\u0437\u043e\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. (\u041a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440, \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>set()<\/code> \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441 <code>S<\/code> \u043d\u0430 <code>A<\/code>).<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ AppState.ts type CounterOp = { operation: 'add' | 'subtract' | 'set'; arg: number; };  export const appCounter = createShared&lt;number, CounterOp>(     0,     (previousValue, { operation, arg }) => {         switch(operation) {             case 'add': return previousValue + arg;             case 'subtract': return previousValue - arg;             case 'set': return arg;         }         throw new Error(`appCounter Reducer: operation ${operation} is not supported!`)     } );<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ Counter.tsx const CounterControls = () => {     const reset = () => appCounter.set({operation: 'set', arg: 0});     const addOne = () => appCounter.set({operation: 'add', arg: 1});     return (&lt;>         &lt;button onClick={reset} > Reset &lt;\/button>         &lt;button onClick={addOne} > Add 1 &lt;\/button>     &lt;\/>); };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0435\u0441\u043b\u0438 \u0432 <code>appCounter.set()<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0442\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0437\u0432\u0430\u0432\u0448\u0443\u044e <code>set()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u043e\u0448\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>set()<\/code> \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u0430\u043b\u0438\u0434\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const toggleBetween0and1 = () => appCounter.set(     previousValue => ({         operation: (previousValue > 0? 'subtract' : 'add'),         arg: 1     }) );<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"biblioteka-redyuserov\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u0432<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/AlexIII\/whoosh\/blob\/main\/docs\/reducer-lib.md\" rel=\"nofollow noopener noreferrer\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 <code>toLocalStorage()<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c Shared State \u0432 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Window\/localStorage\" rel=\"nofollow noopener noreferrer\"><code>localStorage<\/code><\/a>;<\/li>\n<li>\u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u044b <code>arrayOp<\/code> \u0438 <code>setOp<\/code>:<br \/> \n<ul>\n<li><code>arrayOp<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0442\u0438\u043f\u0430 <code>Array&lt;S><\/code> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>remove<\/code>, <code>add<\/code>, <code>filter<\/code> \u0438 <code>map<\/code>,<\/li>\n<li><code>setOp<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0442\u0438\u043f\u0430 <code>Set&lt;S><\/code> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>remove<\/code> \u0438 <code>add<\/code>;<\/li>\n<\/ul>\n<\/li>\n<li>\u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>compose()<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"primer-ispolzovaniya-redyusera-arrayop-iz-biblioteki\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 <code>arrayOp<\/code> \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h3>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { arrayOp, ArrayOpInput } from 'whoosh-react\/reducers';  \/\/ Array of strings that also can be undefined type StateType = string[] | undefined; const stateArray = createShared&lt;StateType, ArrayOpInput&lt; StateType >>(     undefined, arrayOp );  \/\/ Valid calls of `set()`: stateArray.set([]); stateArray.set(['abc', '123']); stateArray.set(prev => ['abc', '123', ...prev]);  stateArray.set({remove: 'abc'}); stateArray.set({add: '123'}); stateArray.set({map: (str, idx) => `${idx}-${str}`}); stateArray.set({filter: str => str.length > 0});  stateArray.set({remove: '123', add: 'abc'});  stateArray.set(undefined);<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"primer-kompozicii-redyuserov\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u0432<\/h3>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { toLocalStorage, arrayOp, ArrayOpInput, compose } from 'whoosh-react\/reducers'; import { createShared } from 'whoosh-react';  type MusicGenresType = string[]; const musicGenres = createShared&lt;MusicGenresType, ArrayOpInput&lt;MusicGenresType>>(     [], compose(toLocalStorage('userPreferences.genres'), arrayOp) );  \/\/ ... musicGenres.set({add: 'rock'});<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <code>musicGenres<\/code> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 <code>localStorage<\/code> (\u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043d\u0435\u0433\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435)<br \/>  \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0435 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c <code>arrayOp<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"interfeys-obekta-shared-state\">\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Shared State<\/h2>\n<p>  <\/p>\n<p><code>createShared()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>SharedState<\/code> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ S - \u0422\u0438\u043f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \/\/ A - \u0422\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 input \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 (\u0435\u0441\u043b\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 \u043d\u0435\u0442, \u0442\u043e A === S)  interface SharedState&lt;S, A = S> {     use(): S;     get(): S;     set(a: A | ((s: S) => A)): void;     on(cb: (state: S) => void): () => void;     off(cb: (state: S) => void): void; }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\n<p><code>use()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Shared State.<br \/>  \u042d\u0442\u043e React \u0445\u0443\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0440\u0435-\u0440\u0435\u043d\u0434\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 Shared State. \u0414\u043e\u043b\u0436\u0435\u043d \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f React \u0445\u0443\u043a\u043e\u0432. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445.<\/p>\n<p>  <\/li>\n<li>\n<p><code>get()<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Shared State. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u0440\u0435-\u0440\u0435\u043d\u0434\u0435\u0440\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. <\/p>\n<p>  <\/li>\n<li>\n<p><code>set()<\/code> \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Shared State. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043b\u0438\u0431\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0443\u044e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0443\u044e \u043d\u043e\u0432\u043e\u0435.<br \/>  \u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u0438\u043f\u0430 <code>S<\/code> \u0435\u0441\u043b\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043b\u0438\u0431\u043e \u0442\u0438\u043f\u0430 <code>A<\/code>, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. (\u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <code>S === A<\/code>).<br \/>  \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0440\u0435-\u0440\u0435\u043d\u0434\u0435\u0440 \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0445\u0443\u043a <code>use()<\/code> \u0434\u0430\u043d\u043d\u043e\u0433\u043e Shared State.<\/p>\n<p>  <\/li>\n<li>\n<p><code>on()<\/code> \u0438 <code>off()<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0438 \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430\/\u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 Shared State. \u041f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0432\u044b\u043d\u043e\u0441\u0430 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f Shared State \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<br \/>  <code>on()<\/code> \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u0437\u0432\u0430\u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 Shared State.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>SharedState<\/code> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e <em>\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b<\/em>. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 <code>useEffect<\/code> \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0445\u0443\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>SharedState<\/code> \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0435 (binding, <code>bind()<\/code>). \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0435 <em>\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/em>, \u0430 \u043d\u0435 <em>\u043c\u0435\u0442\u043e\u0434\u044b<\/em>.<\/p>\n<p>  <\/p>\n<h2 id=\"funkciya-createshared\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>createShared()<\/code><\/h2>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ S - \u0422\u0438\u043f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \/\/ A - \u0422\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 input \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 (\u0435\u0441\u043b\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 \u043d\u0435\u0442, \u0442\u043e A = S) \/\/ I - \u0422\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 (\u0435\u0441\u043b\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442)  type Reducer&lt;S, A> = (previousState: S, input: A) => S; type ReducerAndInit&lt;S, A, I> = [ Reducer&lt;S, A>, (initArg: I) => S ]; type ReducerOrReducerWithInit&lt;S, A> = Reducer&lt;S, A> | ReducerAndInit&lt;S, A, S>;  function createShared&lt;S>(     initValue: S,     reducer?: ReducerOrReducerWithInit&lt;S, S> ): SharedState&lt;S, S>;  function createShared&lt;S, A>(     initValue: S,     reducer: ReducerOrReducerWithInit&lt;S, A> ): SharedState&lt;S, A>;  function createShared&lt;S, A, I>(     initValue: I,     reducer: ReducerAndInit&lt;S, A, I> ): SharedState&lt;S, A>;<\/code><\/pre>\n<p>  <\/p>\n<p><code>createShared()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>initialValue<\/code> (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 <code>reducer<\/code> (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e).<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043b\u0438\u0431\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u043b\u0438\u0431\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u043c (\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c) \u0438\u0437 \u0434\u0432\u0443\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 <code>initialValue<\/code> \u0442\u0438\u043f\u0430 <code>I<\/code> \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <code>S<\/code> (\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e <code>I === S<\/code>).<\/p>\n<p>  <\/p>\n<h2 id=\"ispolzovanie-s-klassovymi-komponentami\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438<\/h2>\n<p>  <\/p>\n<p>Whoosh \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <em>\u0442\u043e\u043b\u044c\u043a\u043e<\/em> \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>on()<\/code> \u0432 <code>componentWillMount()<\/code> \u0438 \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>off()<\/code> \u0432 <code>componentWillUnmount()<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043d\u0435 \u043c\u0430\u043b\u0430\u044f \u0434\u043e\u043b\u044f \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430 \u0438\u0434\u0435\u0442 \u043e\u0442 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438: \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u0432 (\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <code>S<\/code> \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438) \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 (\u0442\u043e\u0447\u043d\u0435\u0435, \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f, \u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0435\u0449\u0435 \u0445\u0443\u0436\u0435, \u0431\u043b\u0438\u043d), \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u0432 <code>createShared<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u0435\u0442 \u044f \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u0438\u0442\u0440\u043e \u043f\u0440\u043e\u0434\u0435\u043a\u043b\u0430\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438. \u042d\u043a\u0441\u043f\u0435\u0440\u0442\u044b <code>typescript<\/code>, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"o-nekotoryh-spornyh-resheniyah-otlichnyh-mozhet-byt-ot-obscheprinyatyh\">\u041e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043f\u043e\u0440\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 [\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c] \u043e\u0442 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445<\/h4>\n<p>  <\/p>\n<ul>\n<li>\n<p>\u0423\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043b\u043e\u0433\u0438\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c \u0432 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043e \u043f\u043e\u0434\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u0438\u0434\u0435\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0412\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0434\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 (\u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0443 \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430).<\/p>\n<p>  <\/li>\n<li>\n<p>\u0425\u0443\u043a <code>use()<\/code> \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0447\u043b\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0430 \u043d\u0435 \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <code>import<\/code> \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 Shared State.<br \/>  \u0421\u0435\u0439\u0447\u0430\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { appCounter } from '.\/AppState.ts';  const CounterValue = () => {   const counter = appCounter.use();   return &lt;p> { counter } &lt;\/p>; };<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u043d\u0430\u0447\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { appCounter } from '.\/AppState.ts'; import { useShared } from 'whoosh';  const CounterValue = () => {   const counter = useShared(appCounter);   return &lt;p> { counter } &lt;\/p>; };<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430 \u043d\u0430\u0437\u0432\u0430\u043d <code>input<\/code>, \u0430 \u043d\u0435 <code>action<\/code>, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0435\u0437\u0434\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set()<\/code> \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 <code>createShared()<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 React \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <code>useState()<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c <em>setter<\/em>, \u0430 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u043c <code>useReduce()<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <em>dispatcher<\/em>. <em>Dispatcher<\/em> \u0438\u043c\u0435\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <em>action<\/em>.<br \/>  \u0412 Whoosh \u043d\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441 \u0438 \u0431\u0435\u0437 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0430, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430 \u2014 <code>set()<\/code>. \u0421\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u0438 \u043e\u0442 &#171;\u0441\u043c\u044b\u0441\u043b\u0430&#187; \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u043d\u0435\u0433\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u043d\u0430\u0437\u0432\u0430\u043d \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u043e \u2014 <em>input<\/em>.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<p>  <\/p>\n<hr\/>\n<\/div>\n<\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/post\/599519\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u041a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0431\u0435\u0440\u0435\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u043b\u043e\u0441\u043e\u0432?<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             9.09%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041f\u0435\u0440\u0432\u044b\u0439<\/span> <span class=\"tm-article-poll__answer-votes\">             1           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:9.09%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             36.36%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0412\u0442\u043e\u0440\u043e\u0439<\/span> <span class=\"tm-article-poll__answer-votes\">             4           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:36.36%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             54.55%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041f\u043e\u0440\u043e\u0432\u043d\u0443<\/span> <span class=\"tm-article-poll__answer-votes\">             6           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:54.55%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 11 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.          \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 13 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.      <\/div>\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\/post\/599519\/\"> https:\/\/habr.com\/ru\/post\/599519\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\" class=\"article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u043c. \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u043c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 React, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 <code>createShared()<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"\/img\/image-loader.svg\" data-src=\"https:\/\/habrastorage.org\/webt\/pu\/bc\/jd\/pubcjdq4fszxewd8makwqsuvuqo.png\"\/><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/AlexIII\/whoosh\" rel=\"nofollow noopener noreferrer\">GitHub \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/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-326896","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/326896","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=326896"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/326896\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=326896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=326896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=326896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}