{"id":816,"date":"2022-05-07T16:45:44","date_gmt":"2022-05-07T13:45:44","guid":{"rendered":"https:\/\/webcademy.ru\/blog\/?p=816"},"modified":"2022-06-27T12:46:56","modified_gmt":"2022-06-27T09:46:56","slug":"react-%d0%bf%d1%80%d0%b8%d0%bb%d0%be%d0%b6%d0%b5%d0%bd%d0%b8%d0%b5-%d0%ba%d0%be%d1%80%d0%b7%d0%b8%d0%bd%d0%b0-%d1%82%d0%be%d0%b2%d0%b0%d1%80%d0%be%d0%b2","status":"publish","type":"post","link":"https:\/\/webcademy.ru\/blog\/816\/","title":{"rendered":"React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 &#171;\u041a\u043e\u0440\u0437\u0438\u043d\u0430 \u0442\u043e\u0432\u0430\u0440\u043e\u0432&#187;"},"content":{"rendered":"\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445. \u0412\u0435\u0440\u0441\u0442\u043a\u0430 \u043f\u043e\u0434 React JS. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, SCSS \u0441\u0442\u0438\u043b\u0438 \u0432 React. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e React JS. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0443\u0440\u043e\u043a\u0435<\/h2>\n\n\n\n<p>\u2705 \u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u0432 React JS <br>\u2705 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 React \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 <br>\u2705 \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SCSS \u0432 React <br>\u2705 \u0425\u0443\u043a\u0438 useState, useEffect<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0412\u0438\u0434\u0435\u043e<\/h2>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 React JS. \u041a\u043e\u0440\u0437\u0438\u043d\u0430 \u0442\u043e\u0432\u0430\u0440\u043e\u0432. \u0412\u0435\u0440\u0441\u0442\u043a\u0430 \u0438 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432 \u043d\u0430 React\" width=\"730\" height=\"411\" src=\"https:\/\/www.youtube.com\/embed\/j06nGCV4Gd8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">1.1 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Node.js<\/h4>\n\n\n\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/nodejs.org\/en\/\">https:\/\/nodejs.org\/en\/<\/a>, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e LTS \u0432\u0435\u0440\u0441\u0438\u044e, \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0443\u0440\u043e\u043a\u0430 \u044d\u0442\u043e <code>16.13.0 LTS<\/code><\/p>\n\n\n\n<p>\u0421\u043e\u0432\u0435\u0442. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d node.js &#8212; \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438: <code>node -v<\/code> \u0438 <code>npm -v<\/code>. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0443\u0440\u043e\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 <code>node v16.13.0<\/code> \u0438 <code>npm 8.1.2<\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.2 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u044b create-react-app<\/h4>\n\n\n\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u044b create-react-app c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <a href=\"https:\/\/ru.reactjs.org\/docs\/create-a-new-react-app.html#create-react-app\">https:\/\/ru.reactjs.org\/docs\/create-a-new-react-app.html#create-react-app<\/a><\/p>\n\n\n\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443: <code>npm install -g create-react-app<\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.3 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n\n\n\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0442\u0430\u043a \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0439 \u0438\u043b\u0438 \u0432 \u043f\u0443\u0442\u0438 \u043a \u043d\u0435\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0432 \u043a\u043e\u0440\u043d\u0435 \u0434\u0438\u0441\u043a\u0430 \u0438 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0435\u0435 \u043d\u0430 \u043b\u0430\u0442\u0438\u043d\u0438\u0446\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>C:\\\\FRONTEND PROJECTS<\/code> &#8212; \u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b.<\/p>\n\n\n\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u0432 \u043d\u0435\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443: <code>npx create-react-app cart-js<\/code> \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043f\u043a\u0435 todo-project \u0438 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 todo-project.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.4 \u0417\u0430\u043f\u0443\u0441\u043a react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n\n\n\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 \u0435\u0433\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e: <code>cd cart-js<\/code> \u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>npm run start<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0440\u0430\u0432\u043a\u0430 \u0443 \u0443\u0440\u043e\u043a\u0443<\/h2>\n\n\n\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>increase<\/code>, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<br>\u041f\u0440\u0430\u0432\u043a\u0430 \u0432 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 <code>count<\/code> \u0438  <code>priceTotal<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">const increase = (id) =&gt; {\n\t\tsetCart((cart) =&gt; {\n\t\t\treturn cart.map((product) =&gt; {\n\t\t\t\tif (product.id === id) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...product,\n\t\t\t\t\t\tcount: product.count + 1,\n\t\t\t\t\t\tpriceTotal: (product.count + 1) * product.price,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn product;\n\t\t\t});\n\t\t});\n\t};<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043a \u0443\u0440\u043e\u043a\u0443<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/webcademy.ru\/blog\/792\/\" target=\"_blank\">\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u0423\u0440\u043e\u043a \u043f\u043e \u0432\u0435\u0440\u0441\u0442\u043a\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u0441 \u041a\u043e\u0440\u0437\u0438\u043d\u043e\u0439<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/nodejs.org\/en\/\" target=\"_blank\">Node JS<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/git-scm.com\/\" target=\"_blank\">Git SCM<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u043e\u0434 \u043a \u0443\u0440\u043e\u043a\u0443<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/yadi.sk\/d\/c-3jNoy6saM5Ig\" target=\"_blank\">\u041f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0432\u0435\u0440\u0441\u0442\u043a\u043e\u0439 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0432 React<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/webcademy.ru\/blog\/wp-content\/uploads\/2022\/06\/cart-react-final.zip\" target=\"_blank\">\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0443\u0440\u043e\u043a\u0430<\/a><\/li><\/ul>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445. \u0412\u0435\u0440\u0441\u0442\u043a\u0430 \u043f\u043e\u0434 React JS. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, SCSS \u0441\u0442\u0438\u043b\u0438 \u0432 React. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e React JS. \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0443\u0440\u043e\u043a\u0435 \u2705 \u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0432\u0435\u0440\u0441\u0442\u043a\u0438 \u0432 React JS \u2705 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 React \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u2705 \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SCSS \u0432 React \u2705 \u0425\u0443\u043a\u0438 useState, useEffect \u0412\u0438\u0434\u0435\u043e \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a React \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":817,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,22,16],"tags":[],"class_list":["post-816","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-javascript","category-react-js","category-16"],"_links":{"self":[{"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/posts\/816"}],"collection":[{"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":0,"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/posts\/816\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/media\/817"}],"wp:attachment":[{"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/categories?post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webcademy.ru\/blog\/wp-json\/wp\/v2\/tags?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}