{"id":323180,"date":"2021-05-15T15:00:54","date_gmt":"2021-05-15T15:00:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=323180"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=323180","title":{"rendered":"\u0420\u0430\u0441\u0441\u043a\u0430\u0437 \u043e \u0442\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432 2021 \u0433\u043e\u0434\u0443 \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c TypeScript, \u0430 \u043d\u0435 JavaScript"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f React Native, \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.doabledanny.atomicmeditation\">Atomic Meditation<\/a>. \u042d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0442\u0435\u043c, \u043a\u0442\u043e \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u043c\u0435\u0434\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u0443\u0434\u0435\u043b\u044f\u044f \u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043d\u044f\u0442\u0438\u044e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e TypeScript \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432\u043c\u0435\u0441\u0442\u043e JavaScript \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0438 \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u044f \u043d\u0430\u0447\u043d\u0443 \u0441\u0432\u043e\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437, \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c React Native. \u042f \u0431\u0443\u0434\u0443 \u0432\u0441\u0451 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c. \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043d\u0430 React, \u0442\u043e, \u0447\u0438\u0442\u0430\u044f \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e React \u0438 React Native \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/556162\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ac\/ge\/eq\/acgeeqhqlkbq2z9g0vjxcchywne.jpeg\"><\/a><\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 JavaScript \u0432\u0442\u044f\u043d\u0443\u043b \u043c\u0435\u043d\u044f \u0432 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u0438.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0414\u0435\u043d\u044c 1: \u0432\u0441\u0451 \u0438\u0434\u0451\u0442 \u043a\u0430\u043a \u043d\u0430\u0434\u043e<\/font><\/h2>\n<p>  \u0412 React Native \u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <code>AsyncStorage<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430 \u043a\u043b\u044e\u0447\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c. \u041e\u043d \u0434\u0430\u0451\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">AsyncStorage.setItem(&quot;@key&quot;, value) <\/code><\/pre>\n<p>  <code>AsyncStorage<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043b\u0438\u0448\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0447\u0438\u0441\u043b\u043e \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 React-\u0445\u0443\u043a\u0430 <code>useState<\/code> \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>sessionCount<\/code> \u0438 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0435\u0451 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 0. \u0422\u0443\u0442 \u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>setSessionCount<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>sessionCount<\/code>:<\/p>\n<pre><code class=\"javascript\">const [sessionCount, setSessionCount] = useState(0) <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u0441\u0435\u0430\u043d\u0441 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438 (\u044f, \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438). \u0412 <code>sessionCount<\/code> \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0430\u043d\u0441\u043e\u0432 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c (\u044f \u0431\u0443\u0434\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00abAnxious Andy\u00bb \u2014 \u00ab\u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u0439 \u042d\u043d\u0434\u0438\u00bb). \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c <code>1<\/code> \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u043c\u0443\u0441\u044f \u0432 <code>sessionCount<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>setSessionCount<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>1<\/code> \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <code>sessionCount<\/code>. \u0410 \u043f\u043e\u0442\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0445 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0439 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 <code>AsyncStorage<\/code> \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  \u0412\u0441\u0451 \u044d\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043d\u0435\u043a\u043e\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0430\u0437\u0432\u0430\u0442\u044c <code>saveData<\/code>:<\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u0441\u0435\u0430\u043d\u0441 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438\u2026 const saveData = () =&gt; { \u00a0\u00a0setSessionCount(prev =&gt; { \u00a0\u00a0\u00a0\u00a0const newSessionCount = prev + 1  \u00a0\u00a0\u00a0\u00a0AsyncStorage.setItem(&quot;@my_number&quot;, newSessionCount.toString())  \u00a0\u00a0\u00a0\u00a0return newSessionCount \u00a0\u00a0}) } <\/code><\/pre>\n<p>  \u0412\u0441\u0451 \u0438\u0434\u0451\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u0430\u0448 \u042d\u043d\u0434\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0436\u0435 \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u0439, \u0442\u0438\u0445\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u043b\u0438\u0432 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u0414\u0435\u043d\u044c 2: \u0437\u0430\u0442\u0438\u0448\u044c\u0435 \u043f\u0435\u0440\u0435\u0434 \u0431\u0443\u0440\u0435\u0439<\/font><\/h2>\n<p>  \u0411\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u0439 \u042d\u043d\u0434\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0435\u043c\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0447\u0435\u0440\u0435\u0437 5 \u043c\u0438\u043d\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u044f. \u041d\u043e \u043e\u043d \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u0439, \u043d\u043e \u0435\u0449\u0451 \u0438 \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u0442\u0443\u0442 \u0436\u0435 \u0438\u0434\u0451\u0442 \u043a \u0441\u0435\u0431\u0435 \u0432 \u043a\u043e\u043c\u043d\u0430\u0442\u0443, \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0432\u043e\u0451 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043a\u0440\u0435\u0441\u043b\u043e, \u0443\u0434\u043e\u0431\u043d\u043e (\u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u044f\u0441\u043d\u043e\u0435 \u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435) \u0432 \u043d\u0435\u0433\u043e \u0441\u0430\u0434\u0438\u0442\u0441\u044f \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f, \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u042d\u043d\u0434\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430. \u0412 React \u0445\u0443\u043a <code>useEffect<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043a\u043e\u043b\u043b\u0431\u044d\u043a \u043f\u0440\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u0412 \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0435 \u043c\u044b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u0430 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>setSessionCount()<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u2014 <code>\u00ab1\u00bb<\/code>:<\/p>\n<pre><code class=\"javascript\">useEffect(() =&gt; { \u00a0\u00a0AsyncStorage.getItem(&quot;@my_number&quot;).then(data =&gt; setSessionCount(data)) }, []) <\/code><\/pre>\n<p>  \u0411\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u0439 \u042d\u043d\u0434\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0435\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a <code>sessionCount<\/code> \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c 1, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0445 \u0441\u0435\u0430\u043d\u0441\u043e\u0432 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0436\u0434\u0435, \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u0441\u0435\u0430\u043d\u0441 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438\u2026 const saveData = () =&gt; { \u00a0\u00a0setSessionCount(prev =&gt; { \u00a0\u00a0\u00a0\u00a0const newSessionCount = prev + 1  \u00a0\u00a0\u00a0\u00a0AsyncStorage.setItem(&quot;@my_number&quot;, newSessionCount.toString())  \u00a0\u00a0\u00a0\u00a0return newSessionCount \u00a0\u00a0}) } <\/code><\/pre>\n<p>  \u041a \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b 2 \u0441\u0435\u0430\u043d\u0441\u0430 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438.<\/p>\n<h2><font color=\"#3AC1EF\">\u0414\u0435\u043d\u044c 3: \u0431\u0443\u0440\u044f<\/font><\/h2>\n<p>  \u042d\u043d\u0434\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u2014 \u0443\u0436\u0435 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u044b\u0439, \u0434\u043e\u0441\u0442\u0430\u0451\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432 \u0442\u0440\u0435\u0442\u0438\u0439 \u0440\u0430\u0437 \u043f\u043e\u0434\u0440\u044f\u0434 \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0435\u0430\u043d\u0441 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438 (\u0438 \u0434\u0435\u043b\u0430 \u0443 \u043d\u0435\u0433\u043e \u0438\u0434\u0443\u0442 \u0445\u043e\u0440\u043e\u0448\u043e).<\/p>\n<p>  \u041e\u043d \u0445\u043e\u0447\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u0432 \u0434\u0435\u043b\u0435 \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u044d\u043a\u0440\u0430\u043d \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438. \u00ab\u041e, \u0434\u0430 \u0442\u0443\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e\u00bb, \u2014 \u043f\u0440\u0438\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u0435\u0442 \u043e\u043d. \u00ab\u041e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430!\u00bb.<\/p>\n<p>  \u041d\u043e \u0435\u0433\u043e \u043b\u044e\u0431\u043e\u0432\u044c \u043a \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u0435\u0442\u2026<\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0435\u043c\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u043e\u0432\u0451\u043b 11 \u0441\u0435\u0430\u043d\u0441\u043e\u0432 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438. \u0410 \u043e\u043d-\u0442\u043e \u043c\u0435\u0434\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u0430!<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/fc4\/665\/5ae\/fc46655aed025d9e13da0c9de0523d95.png\"><\/div>\n<p>  <i><font color=\"#999999\">\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043f\u043e \u0441\u0435\u0430\u043d\u0441\u0430\u043c \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438<\/font><\/i><\/p>\n<h2><font color=\"#3AC1EF\">\u0427\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a?<\/font><\/h2>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u0435\u043d\u044c \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 <code>sessionCount<\/code> \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u0447\u0438\u0441\u043b\u043e <code>0<\/code>.<\/p>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u0441\u0435\u0430\u043d\u0441 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438 \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043a <code>sessionCount<\/code> <code>1<\/code>. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u2014 \u0432 <code>\u00ab1\u00bb<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u044d\u0442\u043e \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (\u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u2014 \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435).<\/p>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 <code>sessionCount<\/code> \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0422\u043e \u0435\u0441\u0442\u044c \u2014 <code>\u00ab1\u00bb<\/code> (\u0441\u0442\u0440\u043e\u043a\u0443, \u0430 \u043d\u0435 \u0447\u0438\u0441\u043b\u043e).<\/p>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u0435\u0430\u043d\u0441 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438 \u0438 \u043c\u044b \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a <code>sessionCount<\/code> <code>1<\/code>. \u0410 \u0432 JavaScript <code>\u00ab1\u00bb + 1<\/code> \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f <code>\u00ab11\u00bb<\/code>, \u0430 \u043d\u0435 <code>2<\/code>.<\/p>\n<p>  \u041c\u044b \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u0432 \u0447\u0438\u0441\u043b\u043e.<\/p>\n<p>  \u0410 \u0445\u0443\u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0443\u0442 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0432\u044b\u0434\u0430\u043b\u0430 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u042d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043d\u043e\u0439, \u0430 \u043f\u043e\u0437\u0436\u0435 \u0434\u043e\u0432\u0435\u043b\u0430 \u043d\u0430\u0441 \u0434\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u041f\u043e\u0438\u0441\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u0430\u043a\u0438\u043c \u0443\u0436 \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u0435\u043b\u043e\u043c.<\/p>\n<p>  JavaScript \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043d\u0430\u043c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e, \u043d\u0435 \u0441\u043e\u0437\u043d\u0430\u0432\u0430\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c, \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0445\u043e\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<p>  \u0420\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TypeScript.<\/p>\n<h2><font color=\"#3AC1EF\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 TypeScript?<\/font><\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 TypeScript, \u0442\u043e \u0437\u043d\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e, \u0432 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 JavaScript, \u043d\u043e \u043e\u0441\u043d\u0430\u0449\u0451\u043d\u043d\u043e\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0438\u043f\u044b. \u0410 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u2014 TypeScript \u0432\u044b\u0434\u0430\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<p>  \u0411\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c TypeScript-\u043a\u043e\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 TypeScript-\u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u0434\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 JavaScript. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e JavaScript-\u0444\u0430\u0439\u043b\u043e\u0432 (\u0438\u043b\u0438 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u00ab\u0431\u0430\u043d\u0434\u043b\u00bb \u0441 JS-\u043a\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430).<\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 TypeScript \u0432 React Native-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445<\/font><\/h2>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 TypeScript \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 React Native-\u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/reactnative.dev\/docs\/typescript\">\u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e<\/a>. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0435-\u0447\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0437 npm \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0441 \u043a\u043e\u0434\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u2014 <code>App.js<\/code> \u0432 <code>App.tsx<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430, TypeScript \u0440\u0430\u0437\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u0433\u043d\u0435\u0432\u043d\u043e\u0439 \u0442\u0438\u0440\u0430\u0434\u043e\u0439 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0442\u0438\u043f\u0430 <code>'string | null'<\/code> \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u0442\u0438\u043f\u0430 <code>'SetStateAction&lt;number&gt;'<\/code>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3c2\/ec8\/11a\/3c2ec811a61c1d925cf91f0f3350f828.png\"><\/div>\n<p>  <i><font color=\"#999999\">TypeScript \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a<\/font><\/i><\/p>\n<p>  \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u043d\u0435 \u0442\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u043d\u0430\u0434\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c <code>data<\/code> \u043d\u0430 <code>null<\/code>, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0447\u0438\u0441\u043b\u043e (\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c <code>parseInt()<\/code>):<\/p>\n<pre><code class=\"javascript\">useEffect(() =&gt; { \u00a0\u00a0AsyncStorage.getItem(&quot;@my_number&quot;).then(data =&gt; { \u00a0\u00a0\u00a0\u00a0if (data) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0setSessionCount(parseInt(data)) \u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0}) }, []) <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 TypeScript \u043f\u043e\u0434\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e!<\/p>\n<h2><font color=\"#3AC1EF\">\u041f\u043e \u043a\u0430\u043a\u0438\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c \u0438\u0437\u0443\u0447\u0430\u0442\u044c TypeScript?<\/font><\/h2>\n<p>  \u042f \u0438\u0437\u0443\u0447\u0430\u043b TypeScript \u043f\u043e <a href=\"https:\/\/www.youtube.com\/watch?v=2pZmKW9-I_k&amp;list=PL4cUxeGkcC9gUgr39Q_yD6v-bSyMwKPUI&amp;ab_channel=TheNetNinja\">\u044d\u0442\u043e\u043c\u0443<\/a> \u0432\u0438\u0434\u0435\u043e\u043a\u0443\u0440\u0441\u0443 \u043a\u0430\u043d\u0430\u043b\u0430 Net Ninja. \u0418 \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u0437\u0443\u0447\u0438\u0442\u044c, \u0442\u043e \u044f \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u0431\u044b \u0442\u0435\u043c, \u043d\u0435\u0442 \u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u043a\u0430\u043d\u0430\u043b\u0435 \u043a\u0443\u0440\u0441\u0430 \u043f\u043e \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f <a href=\"https:\/\/www.typescriptlang.org\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043f\u043e TypeScript \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0430.<\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0442\u043e\u0433\u0438<\/font><\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f TypeScript, \u044f \u043c\u043e\u0433\u0443 \u0441\u043f\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u0435\u0435, \u0437\u043d\u0430\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043c\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0442\u0438\u043f\u044b. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u044d\u0442\u043e TypeScript.<\/p>\n<p>  \u0414\u0430, \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e JavaScript \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u041d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u0441\u0440\u0435\u0434\u043d\u0438\u043c\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u2014 \u043d\u0430\u0434 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0440\u0430\u0441\u0442\u0438, \u043b\u0443\u0447\u0448\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a TypeScript, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0435\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435. \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 JavaScript, \u0442\u043e \u0438 TypeScript \u043e\u0441\u0432\u043e\u0438\u0442\u0435 \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0442\u0440\u0443\u0434\u0430.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b TypeScript \u0432 \u0441\u0432\u043e\u0438\u0445 React-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445?<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/557204\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ty\/b7\/fd\/tyb7fdkkt98xbfhc-jlqbuybdda.jpeg\"><\/a><br \/>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=perevod&amp;utm_campaign=rasskaz_o_tom_pochemu_v_2021_godu_luchshe_vybirat_typescript__a_ne_javascript\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\"><\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/556162\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/556162\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f React Native, \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.doabledanny.atomicmeditation\">Atomic Meditation<\/a>. \u042d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0442\u0435\u043c, \u043a\u0442\u043e \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u043c\u0435\u0434\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u0443\u0434\u0435\u043b\u044f\u044f \u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043d\u044f\u0442\u0438\u044e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e TypeScript \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432\u043c\u0435\u0441\u0442\u043e JavaScript \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0438 \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u044f \u043d\u0430\u0447\u043d\u0443 \u0441\u0432\u043e\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437, \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c React Native. \u042f \u0431\u0443\u0434\u0443 \u0432\u0441\u0451 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c. \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043d\u0430 React, \u0442\u043e, \u0447\u0438\u0442\u0430\u044f \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e React \u0438 React Native \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/556162\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ac\/ge\/eq\/acgeeqhqlkbq2z9g0vjxcchywne.jpeg\"><\/a><\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 JavaScript \u0432\u0442\u044f\u043d\u0443\u043b \u043c\u0435\u043d\u044f \u0432 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u0438.  <\/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-323180","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323180","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=323180"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323180\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}