{"id":294036,"date":"2019-08-29T21:00:53","date_gmt":"2019-08-29T21:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=294036"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=294036","title":{"rendered":"\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0432 React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412 2016 \u0433\u043e\u0434\u0443 TypeScript \u043d\u0430\u0447\u0430\u043b \u0431\u0440\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u044b\u0441\u043e\u0442\u044b. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0438\u043d\u044f\u043b\u0438\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0422\u0430\u043a\u043e\u0439 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0442\u044b\u0441\u044f\u0447, \u0430 \u0442\u043e \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0442\u044b\u0441\u044f\u0447 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 React? \u041f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u044d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u0435\u0441\u0441\u043f\u043e\u0440\u043d\u043e \u0434\u043e\u043c\u0438\u043d\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0444\u043e\u043d\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0432. \u0412\u043e\u043a\u0440\u0443\u0433 React \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u043c\u0438\u0440\u0435. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0440\u0435\u0442\u0438\u0439 SPA \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 <a href=\"https:\/\/clever-solution.com\/case-studies\/problems-of-development-the-legacy-mobile-project\">\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/a>, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c React Native, \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f iOS, UWP \u0438 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 React.js.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0434\u0432\u0443\u0445 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432: TypeScript \u0438 React.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ny\/2i\/rv\/ny2irvf9c5kvptskm2b_mo22kve.png\"><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u0440\u0438\u043c\u0435\u0440\u044b <\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f React.<br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0438\u043f\u044b \u0432 Functional Component.<\/p>\n<pre><code class=\"plaintext\">import * as React from 'react';   const HelloWorld: React.FunctionComponent&lt;{   name: string; }&gt; = ({ name = 'World' }) =&gt; {   return &lt;div&gt;Hello, {props.name}&lt;\/div&gt;; };   export default HelloWorld;<\/code><\/pre>\n<p>  \u0414\u043b\u044f Functional Component \u0438\u043b\u0438 Statless Component \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 React.FunctionComponent. \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 props \u2014 \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 props \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435 name \u0441 \u0442\u0438\u043f\u043e\u043c string.<\/p>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u0410 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u043e\u0432?<\/p>\n<pre><code class=\"plaintext\">import * as React from 'react';   interface State {   name: string; }   interface Props {}   class HelloWorld extends React.Component&lt;Props, State&gt; {   state = {     name: 'World'   }      setName(name: string) {     this.setState({ name });   }      redner() {     return (       &lt;React.Fragment&gt;         &lt;hI&gt;Hello, {this.state.name}&lt;\/hI&gt;         &lt;input value={this.state.name} onChange={(e) =&gt; this.setName(e.target.value)} \/&gt;       &lt;\/React.Fragment&gt;     );   } }<\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0432\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430: Props \u0438 State. \u0421 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0440\u043e\u043f\u0441\u043e\u0432 (\u043f\u0443\u0441\u0442\u044b\u0435) \u0438 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u2014 \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 Functional Components.<\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043f\u0441\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"plaintext\">import * as React from 'react';   interface Props {   name?: string; }   export default class HelloWorld extends React.Component&lt;Props&gt; {   static defaultProps: Props = {     name: 'World'   };     render () {     return &lt;hI&gt;Hello, {this.props.name}&lt;\/hI&gt;;   } }<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435! \u041d\u0430\u0448\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u043e \u043d\u0430\u043c \u0434\u0430\u043b\u043e:<\/p>\n<ul>\n<li>\u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0438\u043f\u043e\u0432;<\/li>\n<li>\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0435\u0449\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u044f \u043d\u0435\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440 \u0438\u043b\u0438 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445;<\/li>\n<li>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u043e\u0432.<\/li>\n<\/ul>\n<h2>Enum \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445<\/h2>\n<p>  Enum \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043f\u043e\u043b\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 Enum.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<pre><code class=\"plaintext\"> import * as React from 'react';   enum Colors {   RED,   BLUE,   GREEN }   const ColorResult: React.FunctionComponent&lt;{   color: Colors; }&gt; = ({ color = Colors.Red }) =&gt; {   return &lt;div&gt;Your color is {props.color}&lt;\/div&gt;; };   export default ColorResult;<\/code><\/pre>\n<p>  \u0412 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u043c \u043d\u0430\u043c Functional Component \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0446\u0432\u0435\u0442. \u0412 \u0442\u0438\u043f\u0435 enum Colors \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0446\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 TypeScript \u0443\u0432\u0438\u0434\u0438\u0442 \u0433\u0434\u0435 \u0442\u043e \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0442\u0438\u043f\u0430\u043c, \u043e\u043d \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0432\u0430\u043c \u044d\u0442\u043e, \u0432\u044b\u0434\u0430\u0432 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<h2>\u0421\u0442\u0440\u043e\u0433\u0438\u0439 Redux<\/h2>\n<p>  \u0412 2019 \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0438\u043c\u0435\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 Redux. TypeScript \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"plaintext\">import * as React from 'react';   const initialState = { name: 'World' }; type HelloWorldStateProps = Readonly&lt;typeof initialState&gt;;   interface Action { \ttype: string;   name?: string; }   const worldNameReducer = ( \tstate: HelloWorldStateProps = initialState, \taction: Action ): HelloWorldStateProps =&gt; { \tswitch (action.type) { \t\tcase \"SET\": \t\t\treturn { name: action.name }; \t\tcase \"CLEAR\": \t\t\treturn { name: initialState.name }; \t\tdefault: \t\t\treturn state; \t} };   const set = (name): Action =&gt; ({ type: \"SET\", name }); const clear = (): Action =&gt; ({ type: \"CLEAR\" });   const store = createStore( \tcombineReducers({ \t\tworld: worldNameReducer \t}) );   type StateProps = ReturnType&lt;typeof mapStateToProps&gt;; type DispatchProps = typeof mapDispatchToProps;   interface AppProps extends StateProps, DispatchProps {} interface AppState extends StateProps {}   class App extends React.Component&lt;AppProps, AppState&gt; {   state = {     name: initialState.name   }      setName(name: string) {     this.setState({ name });   }   \trender() { \t\tconst { set, clear, name } = this.props; \t\treturn ( \t\t\t&lt;div&gt; \t\t\t\t&lt;hI&gt;Hello, {name}&lt;\/hI&gt;         &lt;input value={this.state.name} onChange={(e) =&gt; this.setName(e.target.value)} \/&gt;                  &lt;button onClick={() =&gt; set(this.state.name)}&gt;Save Name&lt;\/button&gt;         &lt;button onClick={() =&gt; clear()}&gt;Clear&lt;\/button&gt; \t\t\t&lt;\/div&gt; \t\t); \t} }   const mapStateToProps = ({ world }: { world: HelloWorldStateProps }) =&gt; ({ \tname: world.name, });   const mapDispatchToProps = { set, clear };   const AppContainer = connect( \tmapStateToProps, \tmapDispatchToProps )(App);   render( \t&lt;Provider store={store}&gt; \t\t&lt;AppContainer \/&gt; \t&lt;\/Provider&gt;, \tdocument.getElementById(\"root\") );<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0438\u043f\u044b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u044d\u0442\u043e \u0441\u0430\u043c\u0438 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u044b. \u041d\u0430 \u0432\u0445\u043e\u0434 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 Action, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f\u0443 HelloWorldStateProps. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043a\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u043e\u0432 \u0431\u044b\u0432\u0430\u0435\u0442 \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u0436\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 action \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 Action.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u2014 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f AppProps \u0438 AppState. \u0417\u0430\u0447\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430\u043c\u0438? \u0422\u0430\u043a \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0449\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0443\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u043c.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  TypeScript \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0432\u0435\u0440\u0445 JavaScript. \u0412 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 React \u043e\u043d \u0434\u0430\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Frontend \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/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\/ru\/post\/465461\/\"> https:\/\/habr.com\/ru\/post\/465461\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0412 2016 \u0433\u043e\u0434\u0443 TypeScript \u043d\u0430\u0447\u0430\u043b \u0431\u0440\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u044b\u0441\u043e\u0442\u044b. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0438\u043d\u044f\u043b\u0438\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0422\u0430\u043a\u043e\u0439 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0442\u044b\u0441\u044f\u0447, \u0430 \u0442\u043e \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0442\u044b\u0441\u044f\u0447 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 React? \u041f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u044d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u0435\u0441\u0441\u043f\u043e\u0440\u043d\u043e \u0434\u043e\u043c\u0438\u043d\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0444\u043e\u043d\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0432. \u0412\u043e\u043a\u0440\u0443\u0433 React \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u043c\u0438\u0440\u0435. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0440\u0435\u0442\u0438\u0439 SPA \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 <a href=\"https:\/\/clever-solution.com\/case-studies\/problems-of-development-the-legacy-mobile-project\">\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/a>, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c React Native, \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f iOS, UWP \u0438 Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 React.js.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0434\u0432\u0443\u0445 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432: TypeScript \u0438 React.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ny\/2i\/rv\/ny2irvf9c5kvptskm2b_mo22kve.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-294036","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294036","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=294036"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294036\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}