{"id":291548,"date":"2018-10-29T18:35:02","date_gmt":"2018-10-29T15:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291548"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291548","title":{"rendered":"\u041f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 RBAC \u0432 ReactJS"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c!<\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u043e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430) \u043d\u0430\u0437\u0430\u0434 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 ReactJS \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043f\u0440\u0430\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u00ab\u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438\u00bb. \u0421\u0442\u0430\u0442\u044c\u044f <a name=\"habracut\"><\/a> &quot;<a href=\"https:\/\/hackernoon.com\/role-based-authorization-in-react-c70bb7641db4\">Role based authorization in React<\/a>&quot; \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/reactjs.org\/docs\/higher-order-components.html\">Higher-Order Components<\/a> (HOC). \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u0435\u043d\u044f \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442, \u043d\u0435 \u043d\u0430\u0448\u0435\u043b.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0438\u0434\u0438\u043c\u043e, \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0447\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u0442\u0438\u043b&#8230;<\/b><\/p>\n<div class=\"spoiler_text\">\u2026 \u0438\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u043b \u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u0432. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <a href=\"https:\/\/stackoverflow.com\/questions\/42567575\/hide-some-react-component-children-depending-on-user-role\/47579290#47579290\">\u043e\u0442\u0432\u0435\u0442 \u0432 stackoverflow<\/a>. \u0423 \u043c\u0435\u043d\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.  <\/div>\n<\/div>\n<p>  \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u00abreact-redux-connect\u00bb (npm-\u043c\u043e\u0434\u0443\u043b\u044c), \u0438 \u043c\u0435\u043d\u044f \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0446\u0435\u043f\u0438\u043b \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 connect. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 connect \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/medium.com\/devschacht\/jakob-lind-code-your-own-redux-part-2-the-connect-function-d941dc247c58\">\u0442\u0443\u0442<\/a>.<\/p>\n<h3> \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f <\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a\u0430\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f (\u043a\u0430\u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u0440\u0430\u0432\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0430\u0432\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f). \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <b>\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/b> (\u0438\u043b\u0438 requirement \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c). \u041f\u043e\u043d\u044f\u0442\u044c, \u0431\u044b\u043b\u043e \u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u043e, \u043c\u043e\u0436\u0435\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <b>\u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043f\u0440\u0430\u0432 <\/b>\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2014 <b>credentials<\/b>. \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"javascript\">function isSatisfied(requirement, credentials) {   if (...) {     return false;   }   return true; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. \u0410 \u043a\u0430\u043a \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c?<\/p>\n<p>  1. \u041c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 \u043b\u043e\u0431:<\/p>\n<pre><code class=\"javascript\">const requirement = {...};  class App extends Component {   render() {     const {credentials} = this.props;      return isSatisfied(requirement, credentials) && &lt;TargetComponent&gt;;   } } <\/code><\/pre>\n<p>  2. \u041c\u043e\u0436\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u0447\u0443\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u0438 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const requirement = {...};  class ProtectedTargetComponent extends Component {   render() {     const {credentials} = this.props;      return (       isSatisfied(requirement, credentials)         ? &lt;TargetComponent {...this.props}&gt;             {this.props.children}           &lt;\/TargetComponent&gt;         : null     );   } }  class App extends Component {   render() {     const {credentials} = this.props;      return &lt;ProtectedTargetComponent\/&gt;;   } } <\/code><\/pre>\n<p>  \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0443\u0442\u043e\u0440\u043d\u043e. \u041a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c?<\/p>\n<p>  3. \u041c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0443 HOC (\u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 connect \u0438\u0437 \u00abreact-redux-connect\u00bb):<\/p>\n<pre><code class=\"javascript\">function protect(requirement, WrappedComponent) {   return class extends Component {     render() {       const { credentials } = this.props;        return (         isSatisfied(requirement, credentials)           ? &lt;WrappedComponent {...this.props}&gt;               {this.props.children}             &lt;\/WrappedComponent&gt;           : null       );     }   } } ... const requireAdmin = {...}; const AdminButton = protect(requireAdmin, Button); ... class App extends Component {   render() {     const {credentials} = this.props;     return (      ...        &lt;AdminButton credentials={credentials}&gt;          Add user        &lt;\/AdminButton&gt;      ...    );   } } <\/code><\/pre>\n<p>  \u0423\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0435 \u0443\u0431\u043e\u0433\u043e \u2014 \u043d\u0443\u0436\u043d\u043e \u0440\u0443\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c credentials \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0451 \u0434\u0435\u0440\u0435\u0432\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0427\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c? \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e credentials \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2014 \u044d\u0442\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u043e\u0433\u0434\u0430 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u00abreact-redux-connect\u00bb. \u041f\u043e\u0447\u0438\u0442\u0430\u0432 \u0441\u0442\u0430\u0442\u044c\u044e \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u043d\u0451\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0435 <a href=\"https:\/\/reactjs.org\/docs\/context.html\">\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b<\/a> ReactJS.<\/p>\n<p>  4. \u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">const { Provider, Consumer } = React.createContext();  function protect(requirement, WrappedComponent) {   return class extends Component {     render() {       return (         &lt;Consumer&gt;           { credentials =&gt; isSatisfied(requirement, credentials)             ? &lt;WrappedComponent {...this.props}&gt;                  {this.props.children}                &lt;\/WrappedComponent&gt;             : null           }         &lt;\/Consumer&gt;       );     }   } } ... const requireAdmin = {...}; const AdminButton = protect(requireAdmin, Button); ... class App extends Component {   render() {     const { credentials } = this.props;     return (         &lt;Provider value={credentials}&gt;         ...            &lt;AdminButton&gt;              Add user            &lt;\/AdminButton&gt;         ...         &lt;\/Provider&gt;     );   } } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h3>\n<p>  \u042d\u0442\u043e \u0431\u044b\u043b \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 \u0441\u0430\u043c\u0443 \u0438\u0434\u0435\u044e. \u041d\u0430 \u0431\u0430\u0437\u0435 \u044d\u0442\u043e\u0439 \u0438\u0434\u0435\u0438 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u043e\u0434\u0443\u043b\u044c (<a href=\"https:\/\/github.com\/nurzhan-saktaganov\/react-rbac-guard\">github<\/a>, <a href=\"https:\/\/www.npmjs.com\/package\/react-rbac-guard\">npm<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0435\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c (\u0441\u043c. README.md \u0432 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0438 <a href=\"https:\/\/codesandbox.io\/s\/znmxlw59jm\">\u0434\u0435\u043c\u043e<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044f).<\/p>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435 \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 npm \u043f\u0430\u043a\u0435\u0442 \u0432 \u0434\u0435\u043c\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0442\u0443\u0434\u0430 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0430\u043c \u043a\u043e\u0434 \u043c\u043e\u0434\u0443\u043b\u044f. \u041d\u043e \u043c\u043e\u0434\u0443\u043b\u044c, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 <b>npm install react-rbac-guard<\/b>, \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (Chrome 69.0.3497.100). \u041f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0441\u043f\u043e\u0441\u043e\u0431\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u2014 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u0444\u0430\u0439\u043b\u044b package.json \u0438 webpack.config.prod.js \u0438\u0437 <a href=\"https:\/\/github.com\/brainhubeu\/react-permissible\">\u043c\u043e\u0434\u0443\u043b\u044f<\/a> \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043d\u0435\u0434\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0433\u043e (\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0432 <a href=\"https:\/\/codesandbox.io\">https:\/\/codesandbox.io<\/a> \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b). \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b, \u0442\u043e \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c!<\/p>\n<p>  P.P.S.: \u0412\u0441\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043f\u0440\u0430\u0432\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 README.md, \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0442\u044c \u0432 \u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/428143\/\"> https:\/\/habr.com\/post\/428143\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c!<\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u043e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430) \u043d\u0430\u0437\u0430\u0434 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 ReactJS \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043f\u0440\u0430\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u00ab\u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438\u00bb. \u0421\u0442\u0430\u0442\u044c\u044f <\/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-291548","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291548","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=291548"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291548\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}