{"id":378818,"date":"2024-06-13T21:00:39","date_gmt":"2024-06-13T21:00:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=378818"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=378818","title":{"rendered":"<span>React. \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u043e\u0432 \u0438 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u043b\u043d\u0443\u044e\u0442 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u0436\u0438\u0434\u0430\u044e\u0442 \u043c\u043e\u043b\u043d\u0438\u0435\u043d\u043e\u0441\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u0438\u043a\u0430, \u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0442\u0440\u0435\u043c\u044f\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043e\u0449\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f. \u041c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0447\u0442\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0431\u0449\u0435\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442&#187; \u0434\u0432\u0438\u0436\u043a\u0430 React \u0438 \u0443\u0432\u0438\u0434\u0435\u043c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u043e\u0432. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0435\u0451 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u0430\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f?<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441 \u0442\u0435\u043e\u0440\u0438\u0438. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u0443\u044e \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0437\u0430 \u0441\u0447\u0451\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 React \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043e\u043a \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043e\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u0412\u0442\u043e\u0440\u044b\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043e\u0440\u043e\u0433\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u043d\u0434\u0435\u0440\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u043d\u043e &#171;\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442&#187; \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<h3>\u0413\u0434\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442?<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435 React Fiber. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/786102\/\" rel=\"noopener noreferrer nofollow\">\u0414\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 React. \u0420\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u044f\u0446\u0438\u044f, \u0440\u0435\u043d\u0434\u0435\u0440\u044b, Fiber, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e<\/a>. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e, Fiber &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u043a\u0430 React, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0443\u0437\u0435\u043b React, \u0431\u0443\u0434\u044c \u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0445\u0443\u043a \u0438\u043b\u0438 host root. \u0423 Fiber, \u043a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u00a0<code>pendingProps<\/code>,\u00a0<code>memoizedProps<\/code>\u00a0\u0438\u00a0<code>memoizedState<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h3>\u041c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b<\/h3>\n<p>\u0425\u043e\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 React \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 Fiber. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0418 \u043d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0439 &#171;\u0441\u0442\u0430\u0440\u043e\u0439&#187; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b React.<\/p>\n<p>\u0415\u0449\u0435 \u0441 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 React \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 \u0442\u0438\u043f\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435. \u0422\u0438\u043f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u043e\u043c Fiber \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u00a0<code>Fiber.tag<\/code>.\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/786102\/\" rel=\"noopener noreferrer nofollow\">\u0412 \u0432\u044b\u0448\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>\u00a0\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 React 18.2, \u0433\u0434\u0435 \u0432 \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u043e\u0441\u044c 28 \u0442\u0438\u043f\u043e\u0432 . \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 18.3.1 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0445 \u0432\u0441\u0435\u0433\u043e 26 \u0448\u0442\u0443\u043a.<\/p>\n<pre><code class=\"javascript\">export const FunctionComponent = 0; export const ClassComponent = 1; export const IndeterminateComponent = 2; \/\/ Before we know whether it is function or class export const HostRoot = 3; \/\/ Root of a host tree. Could be nested inside another node. export const HostPortal = 4; \/\/ A subtree. Could be an entry point to a different renderer. export const HostComponent = 5; export const HostText = 6; export const Fragment = 7; export const Mode = 8; export const ContextConsumer = 9; export const ContextProvider = 10; export const ForwardRef = 11; export const Profiler = 12; export const SuspenseComponent = 13; export const MemoComponent = 14; export const SimpleMemoComponent = 15; export const LazyComponent = 16; export const IncompleteClassComponent = 17; export const DehydratedFragment = 18; export const SuspenseListComponent = 19; export const ScopeComponent = 21; export const OffscreenComponent = 22; export const LegacyHiddenComponent = 23; export const CacheComponent = 24; export const TracingMarkerComponent = 25;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438, \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438:<\/p>\n<pre><code class=\"javascript\">export const FunctionComponent = 0; export const ClassComponent = 1; export const MemoComponent = 14;<\/code><\/pre>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f?<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0442\u0438\u043f\u0430\u043c Fiber, \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438.\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/786102\/\" rel=\"noopener noreferrer nofollow\">\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>\u00a0\u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0430\u0437\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0443\u0437\u043b\u0430. \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0430\u0437\u0430\u00a0<strong>begin<\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f Fiber, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043d\u0443\u0436\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u0423\u0437\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0435 \u043d\u0435\u0431\u044b\u043b\u0438 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f\u00a0<code>IndeterminateComponent<\/code>,\u00a0<code>LazyComponent<\/code>\u00a0\u0438\u043b\u0438\u00a0<code>IncompleteClassComponent<\/code>. \u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 Fiber \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0440\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u043b\u0435\u0440 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0443\u0437\u0435\u043b. \u0415\u0441\u043b\u0438 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c, \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439\u00a0<code>beginWork<\/code>\u0440\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u043b\u0435\u0440\u0430.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L3699\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L3699<\/a><\/p>\n<pre><code class=\"javascript\">function beginWork(   current: Fiber | null,   workInProgress: Fiber,   renderLanes: Lanes, ): Fiber | null {   ...      switch (workInProgress.tag) {     case IndeterminateComponent: {       return mountIndeterminateComponent(         current,         workInProgress,         workInProgress.type,         renderLanes,       );     }     case LazyComponent: {       const elementType = workInProgress.elementType;       return mountLazyComponent(         current,         workInProgress,         elementType,         renderLanes,       );     }     case FunctionComponent: {       const Component = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === Component           ? unresolvedProps           : resolveDefaultProps(Component, unresolvedProps);       return updateFunctionComponent(         current,         workInProgress,         Component,         resolvedProps,         renderLanes,       );     }     case ClassComponent: {       const Component = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === Component           ? unresolvedProps           : resolveDefaultProps(Component, unresolvedProps);       return updateClassComponent(         current,         workInProgress,         Component,         resolvedProps,         renderLanes,       );     }     case HostRoot:       return updateHostRoot(current, workInProgress, renderLanes);     case HostComponent:       return updateHostComponent(current, workInProgress, renderLanes);     case HostText:       return updateHostText(current, workInProgress);     case SuspenseComponent:       return updateSuspenseComponent(current, workInProgress, renderLanes);     case HostPortal:       return updatePortalComponent(current, workInProgress, renderLanes);     case ForwardRef: {       const type = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === type           ? unresolvedProps           : resolveDefaultProps(type, unresolvedProps);       return updateForwardRef(         current,         workInProgress,         type,         resolvedProps,         renderLanes,       );     }     case Fragment:       return updateFragment(current, workInProgress, renderLanes);     case Mode:       return updateMode(current, workInProgress, renderLanes);     case Profiler:       return updateProfiler(current, workInProgress, renderLanes);     case ContextProvider:       return updateContextProvider(current, workInProgress, renderLanes);     case ContextConsumer:       return updateContextConsumer(current, workInProgress, renderLanes);     case MemoComponent: {       const type = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       \/\/ Resolve outer props first, then resolve inner props.       let resolvedProps = resolveDefaultProps(type, unresolvedProps);       resolvedProps = resolveDefaultProps(type.type, resolvedProps);       return updateMemoComponent(         current,         workInProgress,         type,         resolvedProps,         renderLanes,       );     }     case SimpleMemoComponent: {       return updateSimpleMemoComponent(         current,         workInProgress,         workInProgress.type,         workInProgress.pendingProps,         renderLanes,       );     }     case IncompleteClassComponent: {       const Component = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === Component           ? unresolvedProps           : resolveDefaultProps(Component, unresolvedProps);       return mountIncompleteClassComponent(         current,         workInProgress,         Component,         resolvedProps,         renderLanes,       );     }     case SuspenseListComponent: {       return updateSuspenseListComponent(current, workInProgress, renderLanes);     }     case ScopeComponent: {       if (enableScopeAPI) {         return updateScopeComponent(current, workInProgress, renderLanes);       }       break;     }     case OffscreenComponent: {       return updateOffscreenComponent(current, workInProgress, renderLanes);     }     case LegacyHiddenComponent: {       if (enableLegacyHidden) {         return updateLegacyHiddenComponent(           current,           workInProgress,           renderLanes,         );       }       break;     }     case CacheComponent: {       if (enableCache) {         return updateCacheComponent(current, workInProgress, renderLanes);       }       break;     }     case TracingMarkerComponent: {       if (enableTransitionTracing) {         return updateTracingMarkerComponent(           current,           workInProgress,           renderLanes,         );       }       break;     }   }      ... }<\/code><\/pre>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u043d\u0438\u0442\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043d\u0435\u0442. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u044b \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c, \u0431\u0443\u0434\u0443\u0442 \u043b\u0438 \u0432 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041e\u0441\u0442\u0430\u0432\u043b\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432.<\/p>\n<h3>ClassComponent<\/h3>\n<p>\u0418\u0437 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c. \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/p>\n<pre><code class=\"javascript\">class MyComponent extends React.Component&lt;{ prop1: string }> {   render() {     return (       &lt;div>         {this.props.prop1}       &lt;\/div>     );   } }<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435\u00a0<code>beginWork<\/code>\u00a0\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<pre><code class=\"javascript\">const Component = workInProgress.type; const unresolvedProps = workInProgress.pendingProps; const resolvedProps =   workInProgress.elementType === Component     ? unresolvedProps     : resolveDefaultProps(Component, unresolvedProps); return updateClassComponent(   current,   workInProgress,   Component,   resolvedProps,   renderLanes, );<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0442\u0443\u0442 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430, \u044d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u00a0<code>resolvedProps<\/code>. \u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0430\u0436 5 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u044d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0431\u0435\u0440\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u00a0<code>Fiber.pendingProps<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u043c \u0438\u043d\u044b\u043c, \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0414\u0430\u0431\u044b \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u044f\u0441\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0438 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>resolveDefaultProps<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberLazyComponent.new.js#L12\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberLazyComponent.new.js#L12<\/a><\/p>\n<pre><code class=\"javascript\">export function resolveDefaultProps(Component: any, baseProps: Object): Object {   if (Component &amp;&amp; Component.defaultProps) {     \/\/ Resolve default props. Taken from ReactElement     const props = assign({}, baseProps);     const defaultProps = Component.defaultProps;     for (const propName in defaultProps) {       if (props[propName] === undefined) {         props[propName] = defaultProps[propName];       }     }     return props;   }   return baseProps; }<\/code><\/pre>\n<p>\u0412 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0439 \u044f\u0437\u044b\u043a, \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<pre><code class=\"javascript\">class MyComponent extends React.Component&lt;{ color?: string }> {   static defaultProps = {     color: 'blue',   };    render() {     return (       &lt;div>         {this.props.color}       &lt;\/div>     );   } }  &lt;MyComponent \/>              \/\/ &lt;div>blue&lt;\/div> &lt;MyComponent color=\"red\" \/>  \/\/ &lt;div>red&lt;\/div><\/code><\/pre>\n<p>\u0421\u0430\u043c \u0436\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>updateClassComponent<\/code>. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0451 \u043a\u043e\u0434 \u0432 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0432 \u043d\u0435\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f dev-mode.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L1062\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L1062<\/a><\/p>\n<pre><code class=\"javascript\">function updateClassComponent(   current: Fiber | null,   workInProgress: Fiber,   Component: any,   nextProps: any,   renderLanes: Lanes, ) {   ...   const instance = workInProgress.stateNode;   let shouldUpdate;   if (instance === null) {     resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress);          \/\/ In the initial pass we might need to construct the instance.     constructClassInstance(workInProgress, Component, nextProps);     mountClassInstance(workInProgress, Component, nextProps, renderLanes);     shouldUpdate = true;   } else if (current === null) {     \/\/ In a resume, we'll already have an instance we can reuse.     shouldUpdate = resumeMountClassInstance(       workInProgress,       Component,       nextProps,       renderLanes,     );   } else {     shouldUpdate = updateClassInstance(       current,       workInProgress,       Component,       nextProps,       renderLanes,     );   }   const nextUnitOfWork = finishClassComponent(     current,     workInProgress,     Component,     shouldUpdate,     hasContext,     renderLanes,   );   ...   return nextUnitOfWork; }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 if \u0437\u0434\u0435\u0441\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0432\u044b\u0448\u0435, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0446\u0438\u043a\u043b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u0439\u0434\u0435\u0442 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>updateClassInstance<\/code>, \u0435\u0451 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberClassComponent.new.js#L1123\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberClassComponent.new.js#L1123<\/a><\/p>\n<pre><code class=\"javascript\">\/\/ Invokes the update life-cycles and returns false if it shouldn't rerender. function updateClassInstance(   current: Fiber,   workInProgress: Fiber,   ctor: any,   newProps: any,   renderLanes: Lanes, ): boolean {   const instance = workInProgress.stateNode;      cloneUpdateQueue(current, workInProgress);      const unresolvedOldProps = workInProgress.memoizedProps;   const oldProps =     workInProgress.type === workInProgress.elementType       ? unresolvedOldProps       : resolveDefaultProps(workInProgress.type, unresolvedOldProps);   instance.props = oldProps;   const unresolvedNewProps = workInProgress.pendingProps;      const oldContext = instance.context;   const contextType = ctor.contextType;   let nextContext = emptyContextObject;   if (typeof contextType === 'object' &amp;&amp; contextType !== null) {     nextContext = readContext(contextType);   } else if (!disableLegacyContext) {     const nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);     nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);   }      const getDerivedStateFromProps = ctor.getDerivedStateFromProps;   const hasNewLifecycles =     typeof getDerivedStateFromProps === 'function' ||     typeof instance.getSnapshotBeforeUpdate === 'function';        \/\/ Note: During these life-cycles, instance.props\/instance.state are what   \/\/ ever the previously attempted to render - not the \"current\". However,   \/\/ during componentDidUpdate we pass the \"current\" props.      \/\/ In order to support react-lifecycles-compat polyfilled components,   \/\/ Unsafe lifecycles should not be invoked for components using the new APIs.   if (     !hasNewLifecycles &amp;&amp;     (typeof instance.UNSAFE_componentWillReceiveProps === 'function' ||       typeof instance.componentWillReceiveProps === 'function')   ) {     if (       unresolvedOldProps !== unresolvedNewProps ||       oldContext !== nextContext     ) {       callComponentWillReceiveProps(         workInProgress,         instance,         newProps,         nextContext,       );     }   }      resetHasForceUpdateBeforeProcessing();      const oldState = workInProgress.memoizedState;   let newState = (instance.state = oldState);   processUpdateQueue(workInProgress, newProps, instance, renderLanes);   newState = workInProgress.memoizedState;      if (     unresolvedOldProps === unresolvedNewProps &amp;&amp;     oldState === newState &amp;&amp;     !hasContextChanged() &amp;&amp;     !checkHasForceUpdateAfterProcessing() &amp;&amp;     !(       enableLazyContextPropagation &amp;&amp;       current !== null &amp;&amp;       current.dependencies !== null &amp;&amp;       checkIfContextChanged(current.dependencies)     )   ) {     \/\/ If an update was already in progress, we should schedule an Update     \/\/ effect even though we're bailing out, so that cWU\/cDU are called.     if (typeof instance.componentDidUpdate === 'function') {       if (         unresolvedOldProps !== current.memoizedProps ||         oldState !== current.memoizedState       ) {         workInProgress.flags |= Update;       }     }     if (typeof instance.getSnapshotBeforeUpdate === 'function') {       if (         unresolvedOldProps !== current.memoizedProps ||         oldState !== current.memoizedState       ) {         workInProgress.flags |= Snapshot;       }     }     return false;   }      if (typeof getDerivedStateFromProps === 'function') {     applyDerivedStateFromProps(       workInProgress,       ctor,       getDerivedStateFromProps,       newProps,     );     newState = workInProgress.memoizedState;   }      const shouldUpdate =     checkHasForceUpdateAfterProcessing() ||     checkShouldComponentUpdate(       workInProgress,       ctor,       oldProps,       newProps,       oldState,       newState,       nextContext,     ) ||     \/\/ TODO: In some cases, we'll end up checking if context has changed twice,     \/\/ both before and after `shouldComponentUpdate` has been called. Not ideal,     \/\/ but I'm loath to refactor this function. This only happens for memoized     \/\/ components so it's not that common.     (enableLazyContextPropagation &amp;&amp;       current !== null &amp;&amp;       current.dependencies !== null &amp;&amp;       checkIfContextChanged(current.dependencies));          if (shouldUpdate) {     \/\/ In order to support react-lifecycles-compat polyfilled components,     \/\/ Unsafe lifecycles should not be invoked for components using the new APIs.     if (       !hasNewLifecycles &amp;&amp;       (typeof instance.UNSAFE_componentWillUpdate === 'function' ||         typeof instance.componentWillUpdate === 'function')     ) {       if (typeof instance.componentWillUpdate === 'function') {         instance.componentWillUpdate(newProps, newState, nextContext);       }       if (typeof instance.UNSAFE_componentWillUpdate === 'function') {         instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);       }     }     if (typeof instance.componentDidUpdate === 'function') {       workInProgress.flags |= Update;     }     if (typeof instance.getSnapshotBeforeUpdate === 'function') {       workInProgress.flags |= Snapshot;     }   } else {     \/\/ If an update was already in progress, we should schedule an Update     \/\/ effect even though we're bailing out, so that cWU\/cDU are called.     if (typeof instance.componentDidUpdate === 'function') {       if (         unresolvedOldProps !== current.memoizedProps ||         oldState !== current.memoizedState       ) {         workInProgress.flags |= Update;       }     }     if (typeof instance.getSnapshotBeforeUpdate === 'function') {       if (         unresolvedOldProps !== current.memoizedProps ||         oldState !== current.memoizedState       ) {         workInProgress.flags |= Snapshot;       }     }          \/\/ If shouldComponentUpdate returned false, we should still update the     \/\/ memoized props\/state to indicate that this work can be reused.     workInProgress.memoizedProps = newProps;     workInProgress.memoizedState = newState;   }      \/\/ Update the existing instance's state, props, and context pointers even   \/\/ if shouldComponentUpdate returns false.   instance.props = newProps;   instance.state = newState;   instance.context = nextContext;      return shouldUpdate; }<\/code><\/pre>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e, \u043d\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u0435\u043b\u0430\u0442\u044c? \u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<pre><code class=\"javascript\">const unresolvedOldProps = workInProgress.memoizedProps; const oldProps =   workInProgress.type === workInProgress.elementType     ? unresolvedOldProps     : resolveDefaultProps(workInProgress.type, unresolvedOldProps); instance.props = oldProps; const unresolvedNewProps = workInProgress.pendingProps;<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435. \u0421\u0443\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0432\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b:\u00a0<code>unresolvedOldProps<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u00a0<code>this.props<\/code>\u00a0\u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438\u00a0<code>unresolvedNewProps<\/code>. \u042d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0438 \u0432 \u0441\u0430\u043c\u043e\u0439 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435.<\/p>\n<pre><code class=\"javascript\">const oldContext = instance.context; const contextType = ctor.contextType; let nextContext = emptyContextObject; if (typeof contextType === 'object' &amp;&amp; contextType !== null) {   nextContext = readContext(contextType); } else if (!disableLegacyContext) {   const nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);   nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); } <\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0440\u0435\u0437\u043e\u043b\u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\u00a0<code>oldContext<\/code>\u00a0\u0438\u00a0<code>nextContext<\/code>\u00a0\u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043d\u0430 \u0440\u044f\u0434\u0443 \u0441\u00a0<code>unresolvedOldProps<\/code>\u00a0\u0438\u00a0<code>unresolvedNewProps<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0438\u0445 \u0441\u0442\u043e\u0438\u0442.\u00a0<\/p>\n<pre><code class=\"javascript\">const getDerivedStateFromProps = ctor.getDerivedStateFromProps; const hasNewLifecycles =   typeof getDerivedStateFromProps === 'function' ||   typeof instance.getSnapshotBeforeUpdate === 'function';    \/\/ Note: During these life-cycles, instance.props\/instance.state are what \/\/ ever the previously attempted to render - not the \"current\". However, \/\/ during componentDidUpdate we pass the \"current\" props.  \/\/ In order to support react-lifecycles-compat polyfilled components, \/\/ Unsafe lifecycles should not be invoked for components using the new APIs. if (   !hasNewLifecycles &amp;&amp;   (typeof instance.UNSAFE_componentWillReceiveProps === 'function' ||     typeof instance.componentWillReceiveProps === 'function') ) {   if (     unresolvedOldProps !== unresolvedNewProps ||     oldContext !== nextContext   ) {     callComponentWillReceiveProps(       workInProgress,       instance,       newProps,       nextContext,     );   } }<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0435\u0437 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u044d\u0442\u0430\u043f\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#componentwillreceiveprops\" rel=\"noopener noreferrer nofollow\">componentWillReceiveProps(nextProps)<\/a>, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435. \u0410 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0442\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u00a0<strong>\u0442\u043e\u043b\u044c\u043a\u043e<\/strong>\u00a0\u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 API, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u0432 \u043d\u0435\u043c \u043d\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u0432\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#static-getderivedstatefromprops\" rel=\"noopener noreferrer nofollow\">getDerivedStateFromProps(props, state)<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#getsnapshotbeforeupdate\" rel=\"noopener noreferrer nofollow\">getSnapshotBeforeUpdate(prevProps, prevState)<\/a>.<\/p>\n<pre><code class=\"javascript\">const oldState = workInProgress.memoizedState; let newState = (instance.state = oldState); processUpdateQueue(workInProgress, newProps, instance, renderLanes); newState = workInProgress.memoizedState;<\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u0431\u043b\u043e\u043a. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\u00a0<code>oldState<\/code>\u00a0\u0438\u00a0<code>newState<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0436\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0417\u0434\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435. \u0415\u0441\u043b\u0438 \u0441\u00a0<code>oldState<\/code>\u00a0\u0432\u0441\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043e\u043d \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437\u00a0<code>Fiber.memoizedState<\/code>, \u0442\u043e \u0432\u043e\u0442\u00a0<code>newState<\/code>\u00a0\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e,\u00a0<code>newState<\/code>\u00a0\u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e\u00a0<code>oldState<\/code>. \u0414\u0430\u043b\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0446\u0438\u043a\u043b\u00a0<code>updateQueue<\/code>, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u043e\u043c\u00a0<code>processUpdateQueue<\/code>. \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0432\u043b\u0435\u0447\u0435\u0442 \u043d\u0430\u0441 \u043e\u0442 \u0442\u0435\u043c\u044b \u0441\u0442\u0430\u0442\u044c\u0438. \u0413\u043b\u0430\u0432\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0443\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0438\u0442\u043e\u0433\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 State \u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0435\u0433\u043e \u0432\u00a0<code>workInProgress.memoizedState<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberClassUpdateQueue.new.js#L458\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberClassUpdateQueue.new.js#L458<\/a><\/p>\n<pre><code class=\"javascript\">export function processUpdateQueue&lt;State>(   ...   \/\/ These values may change as we process the queue.   if (firstBaseUpdate !== null) {     ...     workInProgress.memoizedState = newState;   } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0432\u043e\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e\u00a0<code>newState<\/code>\u00a0\u043d\u0430\u0448\u0435\u0439 update-\u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e \u0441\u0431\u043e\u0440 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"javascript\">if (   unresolvedOldProps === unresolvedNewProps &amp;&amp;   oldState === newState &amp;&amp;   !hasContextChanged() &amp;&amp;   !checkHasForceUpdateAfterProcessing() &amp;&amp;   !(     enableLazyContextPropagation &amp;&amp;     current !== null &amp;&amp;     current.dependencies !== null &amp;&amp;     checkIfContextChanged(current.dependencies)   ) ) {   \/\/ If an update was already in progress, we should schedule an Update   \/\/ effect even though we're bailing out, so that cWU\/cDU are called.   if (typeof instance.componentDidUpdate === 'function') {     if (       unresolvedOldProps !== current.memoizedProps ||       oldState !== current.memoizedState     ) {       workInProgress.flags |= Update;     }   }   if (typeof instance.getSnapshotBeforeUpdate === 'function') {     if (       unresolvedOldProps !== current.memoizedProps ||       oldState !== current.memoizedState     ) {       workInProgress.flags |= Snapshot;     }   }   return false; }<\/code><\/pre>\n<p>\u041d\u0435\u0442, \u044d\u0442\u043e \u043f\u043e\u043a\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435, \u043a\u0430\u043a \u043c\u043e\u0433\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043a \u043d\u0435\u043c\u0443 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c, \u0440\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u043b\u0435\u0440, \u0432 \u0446\u0435\u043b\u044f\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u043d\u0430 \u0435\u0433\u043e \u0441\u0442\u0435\u0439\u0442 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u0438 \u043d\u0435 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#forceupdate\" rel=\"noopener noreferrer nofollow\">forceUpdate()<\/a>, \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442 \u0438 \u0432\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"javascript\">if (typeof getDerivedStateFromProps === 'function') {   applyDerivedStateFromProps(     workInProgress,     ctor,     getDerivedStateFromProps,     newProps,   );   newState = workInProgress.memoizedState; }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u0436\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e. \u0418 \u043f\u0435\u0440\u0432\u044b\u043c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#static-getderivedstatefromprops\" rel=\"noopener noreferrer nofollow\">getDerivedStateFromProps(props, state)<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043c\u0435\u043d\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0435\u0442 State \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e newState \u0432 update-\u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"javascript\">const shouldUpdate =   checkHasForceUpdateAfterProcessing() ||   checkShouldComponentUpdate(     workInProgress,     ctor,     oldProps,     newProps,     oldState,     newState,     nextContext,   ) ||   \/\/ TODO: In some cases, we'll end up checking if context has changed twice,   \/\/ both before and after `shouldComponentUpdate` has been called. Not ideal,   \/\/ but I'm loath to refactor this function. This only happens for memoized   \/\/ components so it's not that common.   (enableLazyContextPropagation &amp;&amp;     current !== null &amp;&amp;     current.dependencies !== null &amp;&amp;     checkIfContextChanged(current.dependencies));<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u0441\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u043f\u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0446\u0438\u043a\u043b\u0443, \u0442\u043e\u0447\u043d\u0435\u0435, \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0410 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0441\u0442\u0435\u0439\u0442\u0430 \u0438\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#forceupdate\" rel=\"noopener noreferrer nofollow\">forceUpdate()<\/a>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439\u00a0<code>checkHasForceUpdateAfterProcessing()<\/code>, \u0430 \u0432\u043e\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438\u00a0<code>checkShouldComponentUpdate()<\/code>. \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberClassComponent.new.js#L305\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberClassComponent.new.js#L305<\/a><\/p>\n<pre><code class=\"javascript\">function checkShouldComponentUpdate(   workInProgress,   ctor,   oldProps,   newProps,   oldState,   newState,   nextContext, ) {   const instance = workInProgress.stateNode;   if (typeof instance.shouldComponentUpdate === 'function') {     let shouldUpdate = instance.shouldComponentUpdate(       newProps,       newState,       nextContext,     );     ...     return shouldUpdate;   }      if (ctor.prototype &amp;&amp; ctor.prototype.isPureReactComponent) {     return (       !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)     );   }      return true; }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0439 dev-mode \u043a\u043e\u0434, \u043e\u043d\u0430 \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/Component#shouldcomponentupdate\" rel=\"noopener noreferrer nofollow\">shouldComponentUpdate()<\/a>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0438 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432\u043e\u0437\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435\u00a0<code>PureComponent<\/code>\u00a0\u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f shallow \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438 \u0441\u0442\u0435\u0439\u0442\u0430 (\u043e\u0431 \u044d\u0442\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435).<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"javascript\">if (shouldUpdate) {   \/\/ In order to support react-lifecycles-compat polyfilled components,   \/\/ Unsafe lifecycles should not be invoked for components using the new APIs.   if (     !hasNewLifecycles &amp;&amp;     (typeof instance.UNSAFE_componentWillUpdate === 'function' ||       typeof instance.componentWillUpdate === 'function')   ) {     if (typeof instance.componentWillUpdate === 'function') {       instance.componentWillUpdate(newProps, newState, nextContext);     }     if (typeof instance.UNSAFE_componentWillUpdate === 'function') {       instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);     }   }   if (typeof instance.componentDidUpdate === 'function') {     workInProgress.flags |= Update;   }   if (typeof instance.getSnapshotBeforeUpdate === 'function') {     workInProgress.flags |= Snapshot;   } } else {   \/\/ If an update was already in progress, we should schedule an Update   \/\/ effect even though we're bailing out, so that cWU\/cDU are called.   if (typeof instance.componentDidUpdate === 'function') {     if (       unresolvedOldProps !== current.memoizedProps ||       oldState !== current.memoizedState     ) {       workInProgress.flags |= Update;     }   }   if (typeof instance.getSnapshotBeforeUpdate === 'function') {     if (       unresolvedOldProps !== current.memoizedProps ||       oldState !== current.memoizedState     ) {       workInProgress.flags |= Snapshot;     }   }      \/\/ If shouldComponentUpdate returned false, we should still update the   \/\/ memoized props\/state to indicate that this work can be reused.   workInProgress.memoizedProps = newProps;   workInProgress.memoizedState = newState; }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c, \u043d\u0443 \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c, \u044d\u0442\u0430\u043f\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u043d, \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<ol>\n<li>\n<p><code>componentWillUpdate<\/code>\u00a0(\u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 API)<\/p>\n<\/li>\n<li>\n<p><code>UNSAFE_componentWillUpdate<\/code>\u00a0(\u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 API)<\/p>\n<\/li>\n<li>\n<p><code>componentDidUpdate<\/code><\/p>\n<\/li>\n<li>\n<p><code>getSnapshotBeforeUpdate<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u044b\u0437\u0432\u0430\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442, \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438, \u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0441\u0442\u0435\u0439\u0442 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 memoizedProps \u0438 memoizedState \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0435\u043d\u043d\u043e.<\/p>\n<pre><code class=\"javascript\">\/\/ Update the existing instance's state, props, and context pointers even \/\/ if shouldComponentUpdate returns false. instance.props = newProps; instance.state = newState; instance.context = nextContext;  return shouldUpdate;<\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f. \u041d\u043e\u0432\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0441\u0442\u0435\u0439\u0442 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u041f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0435 (shallow) \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0443\u0436\u0435 \u043f\u0440\u043e\u0437\u0432\u0443\u0447\u0430\u043b\u043e \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0435\u0433\u043e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435. \u041c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 PureComponent. \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PureComponent. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0432\u044b\u0448\u0435 \u0438 \u0441\u043b\u0435\u0433\u043a\u0430 \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c.<\/p>\n<pre><code class=\"javascript\">class MyComponent extends React.PureComponent&lt;{ color?: string }> {   static defaultProps = {     color: 'blue',   };      render() {     return (       &lt;div>         {this.props.color}       &lt;\/div>     );   } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c, \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 (\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0438 \u043e\u0442\u00a0<code>React.Component<\/code>). \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e shallow \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 shallow \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435? \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>shallowEqual<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/shared\/shallowEqual.js#L13\" rel=\"noopener noreferrer nofollow\">\/packages\/shared\/shallowEqual.js#L13<\/a><\/p>\n<pre><code class=\"javascript\">\/**  * Performs equality by iterating through keys on an object and returning false  * when any key has values which are not strictly equal between the arguments.  * Returns true when the values of all keys are strictly equal.  *\/ function shallowEqual(objA: mixed, objB: mixed): boolean {   if (is(objA, objB)) {     return true;   }      if (     typeof objA !== 'object' ||     objA === null ||     typeof objB !== 'object' ||     objB === null   ) {     return false;   }      const keysA = Object.keys(objA);   const keysB = Object.keys(objB);      if (keysA.length !== keysB.length) {     return false;   }      \/\/ Test for A's keys different from B.   for (let i = 0; i &lt; keysA.length; i++) {     const currentKey = keysA[i];     if (       !hasOwnProperty.call(objB, currentKey) ||       !is(objA[currentKey], objB[currentKey])     ) {       return false;     }   }      return true; }<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<ol>\n<li>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\u00a0<code>objA<\/code>\u00a0\u0438\u00a0<code>objB<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0432\u043d\u044b \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u044b \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u044d\u0442\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u0430\u043c\u043e \u0436\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439\u00a0<code>is()<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/shared\/objectIs.js#L10\" rel=\"noopener noreferrer nofollow\">\/packages\/shared\/objectIs.js#L10<\/a><\/p>\n<pre><code class=\"javascript\">\/**  * inlined Object.is polyfill to avoid requiring consumers ship their own  * https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Object\/is  *\/ function is(x: any, y: any) {   return (     (x === y &amp;&amp; (x !== 0 || 1 \/ x === 1 \/ y)) || (x !== x &amp;&amp; y !== y) \/\/ eslint-disable-line no-self-compare   ); }  const objectIs: (x: any, y: any) => boolean =   typeof Object.is === 'function' ? Object.is : is;<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u043c \u0438\u043d\u044b\u043c, \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 Web API &#8212;\u00a0<a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Object\/is\" rel=\"noopener noreferrer nofollow\">Object.is()<\/a>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u044b\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Web API, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u0438\u0444\u0438\u043b.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e, \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0447\u0438\u044e\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438, \u0435\u0441\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>undefined<\/code><\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>null<\/code><\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>true<\/code>, \u043b\u0438\u0431\u043e \u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>false<\/code><\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u043e\u0439 \u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f\u00a0<code>BigInt<\/code>\u00a0\u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f\u00a0<code>Symbol<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0441\u0438\u043c\u0432\u043e\u043b<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0438<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>+0<\/code><\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>-0<\/code><\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0430 \u0440\u0430\u0432\u043d\u044b\u00a0<code>NaN<\/code><\/p>\n<\/li>\n<li>\n<p>\u043b\u0438\u0431\u043e \u043e\u0431\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e \u0438\u043b\u0438\u00a0<code>NaN<\/code>\u00a0\u0438 \u043e\u0431\u0430 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>FunctionComponent<\/h3>\n<p>\u0421 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435.<\/p>\n<pre><code class=\"javascript\">const Component = workInProgress.type; const unresolvedProps = workInProgress.pendingProps; const resolvedProps =   workInProgress.elementType === Component     ? unresolvedProps     : resolveDefaultProps(Component, unresolvedProps); return updateFunctionComponent(   current,   workInProgress,   Component,   resolvedProps,   renderLanes, );<\/code><\/pre>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0430\u0437\u044b begin \u0438\u043d\u0438\u0446\u0438\u0430\u0446\u0438\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u043e\u0433\u043e. \u0417\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0439 update-\u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L965\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L965<\/a><\/p>\n<pre><code class=\"javascript\">function updateFunctionComponent(   current,   workInProgress,   Component,   nextProps: any,   renderLanes, ) {   ...      nextChildren = renderWithHooks(     current,     workInProgress,     Component,     nextProps,     context,     renderLanes,   );   hasId = checkDidRenderIdHook();    ...        if (current !== null &amp;&amp; !didReceiveUpdate) {     bailoutHooks(current, workInProgress, renderLanes);     return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);   }      if (getIsHydrating() &amp;&amp; hasId) {     pushMaterializedTreeId(workInProgress);   }      ...      reconcileChildren(current, workInProgress, nextChildren, renderLanes);   return workInProgress.child; }<\/code><\/pre>\n<p>\u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0437\u0434\u0435\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e flow \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<code>renderWithHooks<\/code>, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L374\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L374<\/a><\/p>\n<pre><code class=\"javascript\">export function renderWithHooks&lt;Props, SecondArg>(   current: Fiber | null,   workInProgress: Fiber,   Component: (p: Props, arg: SecondArg) => any,   props: Props,   secondArg: SecondArg,   nextRenderLanes: Lanes, ): any {   renderLanes = nextRenderLanes;   currentlyRenderingFiber = workInProgress;      ...      workInProgress.memoizedState = null;   workInProgress.updateQueue = null;   workInProgress.lanes = NoLanes;      \/\/ The following should have already been reset   \/\/ currentHook = null;   \/\/ workInProgressHook = null;      \/\/ didScheduleRenderPhaseUpdate = false;   \/\/ localIdCounter = 0;      \/\/ TODO Warn if no hooks are used at all during mount, then some are used during update.   \/\/ Currently we will identify the update render as a mount because memoizedState === null.   \/\/ This is tricky because it's valid for certain types of components (e.g. React.lazy)      \/\/ Using memoizedState to differentiate between mount\/update only works if at least one stateful hook is used.   \/\/ Non-stateful hooks (e.g. context) don't get added to memoizedState,   \/\/ so memoizedState would be null during updates and mounts.   ReactCurrentDispatcher.current =     current === null || current.memoizedState === null       ? HooksDispatcherOnMount       : HooksDispatcherOnUpdate;          let children = Component(props, secondArg);      \/\/ Check if there was a render phase update   if (didScheduleRenderPhaseUpdateDuringThisPass) {     \/\/ Keep rendering in a loop for as long as render phase updates continue to     \/\/ be scheduled. Use a counter to prevent infinite loops.     let numberOfReRenders: number = 0;     do {       didScheduleRenderPhaseUpdateDuringThisPass = false;       localIdCounter = 0;              if (numberOfReRenders >= RE_RENDER_LIMIT) {         throw new Error(           'Too many re-renders. React limits the number of renders to prevent ' +             'an infinite loop.',         );       }              numberOfReRenders += 1;              \/\/ Start over from the beginning of the list       currentHook = null;       workInProgressHook = null;              workInProgress.updateQueue = null;              ReactCurrentDispatcher.current = __DEV__         ? HooksDispatcherOnRerenderInDEV         : HooksDispatcherOnRerender;                children = Component(props, secondArg);     } while (didScheduleRenderPhaseUpdateDuringThisPass);   }      \/\/ We can assume the previous dispatcher is always this one, since we set it   \/\/ at the beginning of the render phase and there's no re-entrance.   ReactCurrentDispatcher.current = ContextOnlyDispatcher;      \/\/ This check uses currentHook so that it works the same in DEV and prod bundles.   \/\/ hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.   const didRenderTooFewHooks =     currentHook !== null &amp;&amp; currentHook.next !== null;        renderLanes = NoLanes;   currentlyRenderingFiber = (null: any);      currentHook = null;   workInProgressHook = null;      didScheduleRenderPhaseUpdate = false;   \/\/ This is reset by checkDidRenderIdHook   \/\/ localIdCounter = 0;      if (didRenderTooFewHooks) {     throw new Error(       'Rendered fewer hooks than expected. This may be caused by an accidental ' +         'early return statement.',     );   }      if (enableLazyContextPropagation) {     if (current !== null) {       if (!checkIfWorkInProgressReceivedUpdate()) {         \/\/ If there were no changes to props or state, we need to check if there         \/\/ was a context change. We didn't already do this because there's no         \/\/ 1:1 correspondence between dependencies and hooks. Although, because         \/\/ there almost always is in the common case (`readContext` is an         \/\/ internal API), we could compare in there. OTOH, we only hit this case         \/\/ if everything else bails out, so on the whole it might be better to         \/\/ keep the comparison out of the common path.         const currentDependencies = current.dependencies;         if (           currentDependencies !== null &amp;&amp;           checkIfContextChanged(currentDependencies)         ) {           markWorkInProgressReceivedUpdate();         }       }     }   }   return children; }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438, \u043e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0432\u0435\u0449\u0438. \u041f\u0435\u0440\u0432\u043e\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440 \u0445\u0443\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u0438\u0445 \u044d\u0442\u0438\u0445 \u0445\u0443\u043a\u043e\u0432. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432 React \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 4 \u0442\u0430\u043a\u0438\u0445 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u0430:<\/p>\n<ul>\n<li>\n<p><code>ContextOnlyDispatcher<\/code><\/p>\n<\/li>\n<li>\n<p><code>HooksDispatcherOnMount<\/code><\/p>\n<\/li>\n<li>\n<p><code>HooksDispatcherOnUpdate<\/code><\/p>\n<\/li>\n<li>\n<p><code>HooksDispatcherOnRender<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0436\u0435 \u0434\u0435\u043b\u0435,\u00a0<code>ContextOnlyDispatcher<\/code>\u00a0\u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445, \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u043e\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0434\u0432\u0438\u0436\u043e\u043a \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443.<\/p>\n<p>\u0418\u0437 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0442\u0440\u0435\u0445,\u00a0<code>HooksDispatcherOnUpdate<\/code>\u00a0\u0438\u00a0<code>HooksDispatcherOnRender<\/code>\u00a0\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0438 \u043e\u0431\u0430 \u0432\u0435\u0434\u0443\u0442 \u043d\u0430 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 update-\u0445\u0443\u043a\u043e\u0432 (<code>updateMemo<\/code>,\u00a0<code>updateCallback<\/code>\u00a0\u0438 \u0442.\u0434.). \u0412\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u043d\u043e\u0441\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440, \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c React \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0445\u0443\u043a\u043e\u0432 \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0430\u0437\u044b. \u041a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u00a0<code>HooksDispatcherOnMount<\/code>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0442\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c mount-\u0445\u0443\u043a\u043e\u0432 (<code>mountMemo<\/code>,\u00a0<code>mountCallback<\/code>, \u0438 \u0442.\u0434.).<\/p>\n<p>\u041f\u0440\u043e \u0445\u0443\u043a\u0438 \u0438 \u0438\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435. \u041f\u043e\u043a\u0430 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u0443\u043a\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438:\u00a0<strong>mount<\/strong>\u00a0\u0438\u00a0<strong>update<\/strong>. \u0418 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0445\u0443\u043a\u043e\u0432 \u0434\u0432\u0438\u0436\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<pre><code class=\"javascript\">ReactCurrentDispatcher.current =     current === null || current.memoizedState === null       ? HooksDispatcherOnMount       : HooksDispatcherOnUpdate;<\/code><\/pre>\n<p>\u0413\u0434\u0435\u00a0<code>current<\/code>\u00a0&#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430\u00a0<code>Fiber.alternate<\/code>. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u00a0<code>null<\/code>, \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0435\u0449\u0435 \u043d\u0438 \u0440\u0430\u0437 \u043d\u0435 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0435\u0441\u043b\u0438\u00a0<code>Fiber.alternate.memoizedState<\/code>\u00a0\u043f\u0443\u0441\u0442\u043e\u0439, \u0442\u043e \u0445\u0443\u043a\u0438 \u0435\u0449\u0435 \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0435\u0449\u0435 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c. \u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u00a0<code>HooksDispatcherOnMount<\/code>. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435 &#8212;\u00a0<code>HooksDispatcherOnUpdate<\/code>.<\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0435, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f &#8212; \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c\u00a0<code>let children = Component(props, secondArg)<\/code>\u00a0\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 \u0446\u0438\u043a\u043b\u0435, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0444\u0430\u0437\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0432\u0441\u0435 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f. \u0418 \u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u00a0<code>Too many re-renders. React limits the number of renders to prevent an infinite loop.<\/code>, \u0435\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442\u00a0<strong>25<\/strong>\u00a0\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<h3>HooksDispatcherOnMount<\/h3>\n<p>\u041a\u043e\u0434 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L2427\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L2427<\/a><\/p>\n<pre><code class=\"javascript\">const HooksDispatcherOnMount: Dispatcher = {   readContext,      useCallback: mountCallback,   useContext: readContext,   useEffect: mountEffect,   useImperativeHandle: mountImperativeHandle,   useLayoutEffect: mountLayoutEffect,   useInsertionEffect: mountInsertionEffect,   useMemo: mountMemo,   useReducer: mountReducer,   useRef: mountRef,   useState: mountState,   useDebugValue: mountDebugValue,   useDeferredValue: mountDeferredValue,   useTransition: mountTransition,   useMutableSource: mountMutableSource,   useSyncExternalStore: mountSyncExternalStore,   useId: mountId,      unstable_isNewReconciler: enableNewReconciler, }; if (enableCache) {   (HooksDispatcherOnMount: Dispatcher).getCacheSignal = getCacheSignal;   (HooksDispatcherOnMount: Dispatcher).getCacheForType = getCacheForType;   (HooksDispatcherOnMount: Dispatcher).useCacheRefresh = mountRefresh; }<\/code><\/pre>\n<p>\u0412\u0441\u0435 mount-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0445\u0443\u043a\u043e\u0432 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0432\u0430\u0436\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0443\u0442\u044c \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0415\u0451 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435\u00a0<code>mountMemo<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L1899\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L1899<\/a><\/p>\n<pre><code class=\"javascript\">function mountMemo&lt;T>(   nextCreate: () => T,   deps: Array&lt;mixed> | void | null, ): T {   const hook = mountWorkInProgressHook();   const nextDeps = deps === undefined ? null : deps;   const nextValue = nextCreate();   hook.memoizedState = [nextValue, nextDeps];   return nextValue; }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u043e\u0434 \u0444\u0443\u043a\u0430 \u0434\u043e \u043d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u0438\u044f \u043f\u0440\u043e\u0441\u0442. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Fiber. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043a\u043e\u043b\u0431\u044d\u043a\u0435\u00a0<code>nextCreate<\/code>. \u0414\u0430\u043b\u0435\u0435, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u00a0<code>Fiber.memoizedState<\/code>. \u0412\u043e\u0442 \u043e\u043d\u0430, \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f!<\/p>\n<h3>HooksDispatcherOnUpdate<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440\u00a0<code>HooksDispatcherOnUpdate<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L2454\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L2454<\/a><\/p>\n<pre><code class=\"javascript\">const HooksDispatcherOnUpdate: Dispatcher = {   readContext,      useCallback: updateCallback,   useContext: readContext,   useEffect: updateEffect,   useImperativeHandle: updateImperativeHandle,   useInsertionEffect: updateInsertionEffect,   useLayoutEffect: updateLayoutEffect,   useMemo: updateMemo,   useReducer: updateReducer,   useRef: updateRef,   useState: updateState,   useDebugValue: updateDebugValue,   useDeferredValue: updateDeferredValue,   useTransition: updateTransition,   useMutableSource: updateMutableSource,   useSyncExternalStore: updateSyncExternalStore,   useId: updateId,      unstable_isNewReconciler: enableNewReconciler, }; if (enableCache) {   (HooksDispatcherOnUpdate: Dispatcher).getCacheSignal = getCacheSignal;   (HooksDispatcherOnUpdate: Dispatcher).getCacheForType = getCacheForType;   (HooksDispatcherOnUpdate: Dispatcher).useCacheRefresh = updateRefresh; }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u044f \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0440\u0430\u043d\u0435\u0435, \u044d\u0442\u043e\u0442 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435\u0440 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u0435\u0434\u0435\u0442 \u043d\u0430 update-\u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0435\u0445 \u0436\u0435 \u0441\u0430\u043c\u044b \u0445\u0443\u043a\u043e\u0432. \u0418 \u0440\u0430\u0437 \u0443\u0436 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u00a0<code>mountMemo<\/code>, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432\u00a0<code>updateMemo<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L1910\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L1910<\/a><\/p>\n<pre><code class=\"javascript\">function updateMemo&lt;T>(   nextCreate: () => T,   deps: Array&lt;mixed> | void | null, ): T {   const hook = updateWorkInProgressHook();   const nextDeps = deps === undefined ? null : deps;   const prevState = hook.memoizedState;   if (prevState !== null) {     \/\/ Assume these are defined. If they're not, areHookInputsEqual will warn.     if (nextDeps !== null) {       const prevDeps: Array&lt;mixed> | null = prevState[1];       if (areHookInputsEqual(nextDeps, prevDeps)) {         return prevState[0];       }     }   }   const nextValue = nextCreate();   hook.memoizedState = [nextValue, nextDeps];   return nextValue; }<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0443\u0442 \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c, \u0445\u0443\u043a \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437\u00a0<code>Fiber.memoizedState[1]<\/code>\u00a0\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442 \u0438\u0445 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>areHookInputsEqual(nextDeps, prevDeps)<\/code>.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L327\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberHooks.new.js#L327<\/a><\/p>\n<pre><code class=\"javascript\">function areHookInputsEqual(   nextDeps: Array&lt;mixed>,   prevDeps: Array&lt;mixed> | null, ) {   ...      if (prevDeps === null) {     if (__DEV__) {       console.error(         '%s received a final argument during this render, but not during ' +           'the previous render. Even though the final argument is optional, ' +           'its type cannot change between renders.',         currentHookNameInDev,       );     }     return false;   }      ...      for (let i = 0; i &lt; prevDeps.length &amp;&amp; i &lt; nextDeps.length; i++) {     if (is(nextDeps[i], prevDeps[i])) {       continue;     }     return false;   }   return true; }<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0451 \u0442\u043e\u0433\u043e \u0436\u0435\u00a0<a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Object\/is\" rel=\"noopener noreferrer nofollow\">Object.is<\/a>.<\/p>\n<h3>MemoComponent<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u0441 \u0442\u0438\u043f\u0435 \u0443\u0437\u043b\u0430 &#8212;\u00a0<code>MemoComponent<\/code>. \u0422\u0430\u043a\u043e\u0439 \u0443\u0437\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/memo\" rel=\"noopener noreferrer nofollow\">React.memo<\/a>.<\/p>\n<pre><code class=\"javascript\">const MyComponent = React.memo&lt;{ color?: string }>(({ color }) => {   return &lt;div>{color}&lt;\/div>; });<\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">const type = workInProgress.type; const unresolvedProps = workInProgress.pendingProps; \/\/ Resolve outer props first, then resolve inner props. let resolvedProps = resolveDefaultProps(type, unresolvedProps);  resolvedProps = resolveDefaultProps(type.type, resolvedProps); return updateMemoComponent(   current,   workInProgress,   type,   resolvedProps,   renderLanes, );<\/code><\/pre>\n<p>Update-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f\u00a0<code>updateMemoComponent<\/code>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u0430\u044f, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0443 \u0435\u0451 \u0447\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L452\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L452<\/a><\/p>\n<pre><code class=\"javascript\">function updateMemoComponent(   current: Fiber | null,   workInProgress: Fiber,   Component: any,   nextProps: any,   renderLanes: Lanes, ): null | Fiber {   ...      const currentChild = ((current.child: any): Fiber); \/\/ This is always exactly one child   const hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(     current,     renderLanes,   );   if (!hasScheduledUpdateOrContext) {     \/\/ This will be the props with resolved defaultProps,     \/\/ unlike current.memoizedProps which will be the unresolved ones.     const prevProps = currentChild.memoizedProps;     \/\/ Default to shallow comparison     let compare = Component.compare;     compare = compare !== null ? compare : shallowEqual;     if (compare(prevProps, nextProps) &amp;&amp; current.ref === workInProgress.ref) {       return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);     }   }   \/\/ React DevTools reads this flag.   workInProgress.flags |= PerformedWork;   const newChild = createWorkInProgress(currentChild, nextProps);   newChild.ref = workInProgress.ref;   newChild.return = workInProgress;   workInProgress.child = newChild;   return newChild; }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0441\u044f \u0441\u0443\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u00a0<code>compare(prevProps, nextProps)<\/code>, \u0433\u0434\u0435\u00a0<code>compare<\/code>\u00a0\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 (\u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/memo\" rel=\"noopener noreferrer nofollow\">React.memo<\/a>) \u0438\u043b\u0438\u00a0<code>shallowEqual<\/code>\u00a0\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0435\u0451 \u043c\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b\u0438 &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442&#187; \u0434\u0432\u0438\u0436\u043a\u0430 React \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043d\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0437\u043b\u043e\u0432. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 React, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0432 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f. \u0415\u0451 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0442\u0440\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 Fiber:\u00a0<code>ClassComponent<\/code>,\u00a0<code>FunctionComponent<\/code>\u00a0\u0438\u00a0<code>MemoComponent<\/code>.<\/p>\n<p>\u0418 \u043f\u043e\u043a\u0443\u0434\u0430 \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c \u044d\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b, \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044b.<\/p>\n<ul>\n<li>\n<p>\u0411\u0443\u0434\u044c \u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0445\u0443\u043a\u0430, React \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0443\u043a\u043d\u0446\u0438\u0438-\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434 &#8212; \u043c\u0435\u0442\u043e\u0434\u00a0<a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Object\/is\" rel=\"noopener noreferrer nofollow\">Object.is()<\/a>\u00a0Web API \u0438\u043b\u0438 \u0435\u0433\u043e \u043f\u043e\u043b\u0438\u0444\u0438\u043b.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0445\u0443\u043a \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438,\u00a0<strong>mount<\/strong>\u00a0\u0438\u00a0<strong>update<\/strong>. \u041f\u0440\u0438 \u0447\u0435\u043c update, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0435\u0440\u0441\u0438\u044e \u0445\u0443\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0438\u0436\u043e\u043a. Mount-\u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a React, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0445\u0443\u043a\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u0430\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438,<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">const value = useMemo(() => {   return a + b }, [a, b]);<\/code><\/pre>\n<p>\u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043d, \u0447\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439<\/p>\n<pre><code class=\"javascript\">const value = useMemo(() => {   return a + b }, [a, b, c]);<\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e,\u00a0<\/p>\n<pre><code class=\"javascript\">const SOME_CONST = \"some value\";  const MyComponent = ({ a, b }) => {   \/\/ \u044d\u0442\u043e\u0442 \u0445\u0443\u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043d   const value1 = useMemo(() => {     return a + SOME_CONST   }, [a]);    \/\/ \u0447\u0435\u043c \u044d\u0442\u043e\u0442   const value2 = useMemo(() => {     return b + SOME_CONST   }, [b, SOME_CONST]);      return null; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041f\u043e \u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">const isEqual = useMemo(() => {   return a === b }, [a, b]);<\/code><\/pre>\n<p>\u041d\u0435 \u0434\u0430\u0441\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u0430\u0436\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0434\u0432\u0438\u0436\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c\u00a0<code>prevDeps.a === currDeps.a<\/code>\u00a0\u0438\u00a0<code>prevDeps.b === currDeps.b<\/code>. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441.<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0442\u0435\u0437\u0438\u0441 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438\u00a0<a href=\"https:\/\/react.dev\/reference\/react\/memo\" rel=\"noopener noreferrer nofollow\">React.memo<\/a>. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0442 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u0435\u0433\u043e \u0435\u0451 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<p>\u042d\u0442\u0443 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u0430\u043a \u0436\u0435, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u043c\u043e\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0435:<\/p>\n<p>RU:\u00a0<a href=\"https:\/\/t.me\/frontend_almanac_ru\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/frontend_almanac_ru<\/a><br \/>EN:\u00a0<a href=\"https:\/\/t.me\/frontend_almanac\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/frontend_almanac<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/articles\/821293\/\"> https:\/\/habr.com\/ru\/articles\/821293\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u043b\u043d\u0443\u044e\u0442 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u0436\u0438\u0434\u0430\u044e\u0442 \u043c\u043e\u043b\u043d\u0438\u0435\u043d\u043e\u0441\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u0438\u043a\u0430, \u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0442\u0440\u0435\u043c\u044f\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043e\u0449\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 React-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f. \u041c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0447\u0442\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0431\u0449\u0435\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442&#187; \u0434\u0432\u0438\u0436\u043a\u0430 React \u0438 \u0443\u0432\u0438\u0434\u0435\u043c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u043e\u0432. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0435\u0451 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u0430\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f?<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441 \u0442\u0435\u043e\u0440\u0438\u0438. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u0443\u044e \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0437\u0430 \u0441\u0447\u0451\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 React \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043e\u043a \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043e\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u0412\u0442\u043e\u0440\u044b\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043e\u0440\u043e\u0433\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u043d\u0434\u0435\u0440\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u043d\u043e &#171;\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442&#187; \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<h3>\u0413\u0434\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442?<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435 React Fiber. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/786102\/\" rel=\"noopener noreferrer nofollow\">\u0414\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 React. \u0420\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u044f\u0446\u0438\u044f, \u0440\u0435\u043d\u0434\u0435\u0440\u044b, Fiber, \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e<\/a>. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e, Fiber &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u043a\u0430 React, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0443\u0437\u0435\u043b React, \u0431\u0443\u0434\u044c \u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0445\u0443\u043a \u0438\u043b\u0438 host root. \u0423 Fiber, \u043a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u00a0<code>pendingProps<\/code>,\u00a0<code>memoizedProps<\/code>\u00a0\u0438\u00a0<code>memoizedState<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h3>\u041c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b<\/h3>\n<p>\u0425\u043e\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 React \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 Fiber. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0418 \u043d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0439 &#171;\u0441\u0442\u0430\u0440\u043e\u0439&#187; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b React.<\/p>\n<p>\u0415\u0449\u0435 \u0441 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 React \u043c\u044b \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 \u0442\u0438\u043f\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435. \u0422\u0438\u043f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u043e\u043c Fiber \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u00a0<code>Fiber.tag<\/code>.\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/786102\/\" rel=\"noopener noreferrer nofollow\">\u0412 \u0432\u044b\u0448\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>\u00a0\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 React 18.2, \u0433\u0434\u0435 \u0432 \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u043e\u0441\u044c 28 \u0442\u0438\u043f\u043e\u0432 . \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 18.3.1 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0445 \u0432\u0441\u0435\u0433\u043e 26 \u0448\u0442\u0443\u043a.<\/p>\n<pre><code class=\"javascript\">export const FunctionComponent = 0; export const ClassComponent = 1; export const IndeterminateComponent = 2; \/\/ Before we know whether it is function or class export const HostRoot = 3; \/\/ Root of a host tree. Could be nested inside another node. export const HostPortal = 4; \/\/ A subtree. Could be an entry point to a different renderer. export const HostComponent = 5; export const HostText = 6; export const Fragment = 7; export const Mode = 8; export const ContextConsumer = 9; export const ContextProvider = 10; export const ForwardRef = 11; export const Profiler = 12; export const SuspenseComponent = 13; export const MemoComponent = 14; export const SimpleMemoComponent = 15; export const LazyComponent = 16; export const IncompleteClassComponent = 17; export const DehydratedFragment = 18; export const SuspenseListComponent = 19; export const ScopeComponent = 21; export const OffscreenComponent = 22; export const LegacyHiddenComponent = 23; export const CacheComponent = 24; export const TracingMarkerComponent = 25;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438, \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438:<\/p>\n<pre><code class=\"javascript\">export const FunctionComponent = 0; export const ClassComponent = 1; export const MemoComponent = 14;<\/code><\/pre>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f?<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0442\u0438\u043f\u0430\u043c Fiber, \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438.\u00a0<a href=\"https:\/\/habr.com\/ru\/articles\/786102\/\" rel=\"noopener noreferrer nofollow\">\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>\u00a0\u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0430\u0437\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0443\u0437\u043b\u0430. \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0430\u0437\u0430\u00a0<strong>begin<\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f Fiber, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043d\u0443\u0436\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u0423\u0437\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0449\u0435 \u043d\u0435\u0431\u044b\u043b\u0438 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f\u00a0<code>IndeterminateComponent<\/code>,\u00a0<code>LazyComponent<\/code>\u00a0\u0438\u043b\u0438\u00a0<code>IncompleteClassComponent<\/code>. \u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 Fiber \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0440\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u043b\u0435\u0440 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0443\u0437\u0435\u043b. \u0415\u0441\u043b\u0438 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c, \u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439\u00a0<code>beginWork<\/code>\u0440\u0435\u043a\u043e\u043d\u0441\u0438\u043b\u043b\u0435\u0440\u0430.<\/p>\n<p><a href=\"https:\/\/github.com\/facebook\/react\/blob\/v18.3.1\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L3699\" rel=\"noopener noreferrer nofollow\">\/packages\/react-reconciler\/src\/ReactFiberBeginWork.new.js#L3699<\/a><\/p>\n<pre><code class=\"javascript\">function beginWork(   current: Fiber | null,   workInProgress: Fiber,   renderLanes: Lanes, ): Fiber | null {   ...      switch (workInProgress.tag) {     case IndeterminateComponent: {       return mountIndeterminateComponent(         current,         workInProgress,         workInProgress.type,         renderLanes,       );     }     case LazyComponent: {       const elementType = workInProgress.elementType;       return mountLazyComponent(         current,         workInProgress,         elementType,         renderLanes,       );     }     case FunctionComponent: {       const Component = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === Component           ? unresolvedProps           : resolveDefaultProps(Component, unresolvedProps);       return updateFunctionComponent(         current,         workInProgress,         Component,         resolvedProps,         renderLanes,       );     }     case ClassComponent: {       const Component = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === Component           ? unresolvedProps           : resolveDefaultProps(Component, unresolvedProps);       return updateClassComponent(         current,         workInProgress,         Component,         resolvedProps,         renderLanes,       );     }     case HostRoot:       return updateHostRoot(current, workInProgress, renderLanes);     case HostComponent:       return updateHostComponent(current, workInProgress, renderLanes);     case HostText:       return updateHostText(current, workInProgress);     case SuspenseComponent:       return updateSuspenseComponent(current, workInProgress, renderLanes);     case HostPortal:       return updatePortalComponent(current, workInProgress, renderLanes);     case ForwardRef: {       const type = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === type           ? unresolvedProps           : resolveDefaultProps(type, unresolvedProps);       return updateForwardRef(         current,         workInProgress,         type,         resolvedProps,         renderLanes,       );     }     case Fragment:       return updateFragment(current, workInProgress, renderLanes);     case Mode:       return updateMode(current, workInProgress, renderLanes);     case Profiler:       return updateProfiler(current, workInProgress, renderLanes);     case ContextProvider:       return updateContextProvider(current, workInProgress, renderLanes);     case ContextConsumer:       return updateContextConsumer(current, workInProgress, renderLanes);     case MemoComponent: {       const type = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       \/\/ Resolve outer props first, then resolve inner props.       let resolvedProps = resolveDefaultProps(type, unresolvedProps);       resolvedProps = resolveDefaultProps(type.type, resolvedProps);       return updateMemoComponent(         current,         workInProgress,         type,         resolvedProps,         renderLanes,       );     }     case SimpleMemoComponent: {       return updateSimpleMemoComponent(         current,         workInProgress,         workInProgress.type,         workInProgress.pendingProps,         renderLanes,       );     }     case IncompleteClassComponent: {       const Component = workInProgress.type;       const unresolvedProps = workInProgress.pendingProps;       const resolvedProps =         workInProgress.elementType === Component           ? unresolvedProps           : resolveDefaultProps(Component, unresolvedProps);       return mountIncompleteClassComponent(         current,         workInProgress,         Component,         resolvedProps,         renderLanes,       );     }     case SuspenseListComponent: {       return updateSuspenseListComponent(current, workInProgress, renderLanes);     }     case ScopeComponent: {       if (enableScopeAPI) {         return updateScopeComponent(current, workInProgress, renderLanes);       }       break;     }     case OffscreenComponent: {       return updateOffscreenComponent(current, workInProgress, renderLanes);     }     case LegacyHiddenComponent: {       if (enableLegacyHidden) {         return updateLegacyHiddenComponent(           current,           workInProgress,           renderLanes,         );       }       break;     }     case CacheComponent: {       if (enableCache) {         return updateCacheComponent(current, workInProgress, renderLanes);       }       break;     }     case TracingMarkerComponent: {       if (enableTransitionTracing) {         return updateTracingMarkerComponent(           current,           workInProgress,           renderLanes,         );       }       break;     }   }      ... }<\/code><\/pre>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u043d\u0438\u0442\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043d\u0435\u0442. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-378818","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/378818","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=378818"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/378818\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=378818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=378818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=378818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}