{"id":4750,"date":"2023-01-04T18:06:03","date_gmt":"2023-01-04T10:06:03","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4750"},"modified":"2023-01-04T18:06:03","modified_gmt":"2023-01-04T10:06:03","slug":"%e8%a7%a3%e6%b1%bareact-js%e4%b8%ad%e3%80%8cinvariantviolationfindcomponentroot%e3%80%8d%e7%9a%84%e9%8c%af%e8%aa%a4","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/%e8%a7%a3%e6%b1%bareact-js%e4%b8%ad%e3%80%8cinvariantviolationfindcomponentroot%e3%80%8d%e7%9a%84%e9%8c%af%e8%aa%a4\/","title":{"rendered":"\u89e3\u6c7aReact.js\u4e2d\u300cInvariantViolation:findComponentRoot\u300d\u7684\u932f\u8aa4"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React.js, Error, Invariant Violation, findComponentRoot, DOM, mutated, browser, tbody, tags, SVG, elements, React ID\"><\/p>\n<h1>\u89e3\u6c7a React.js &#8220;Error: Invariant Violation: findComponentRoot(&#8230;, .0): Unable to find element&#8221; \u932f\u8aa4<\/h1>\n<p>React.js \u662f\u4e00\u500b\u7528\u65bc\u69cb\u5efa\u7528\u6236\u754c\u9762\u7684 JavaScript \u5eab\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u8f15\u9b06\u5730\u69cb\u5efa\u9ad8\u6027\u80fd\u7684\u7db2\u9801\u61c9\u7528\u7a0b\u5e8f\u3002\u7136\u800c\uff0c\u5728\u4f7f\u7528 React.js \u6642\uff0c\u958b\u767c\u8005\u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u932f\u8aa4\uff0c\u5176\u4e2d\u4e00\u500b\u662f &#8220;Error: Invariant Violation: findComponentRoot(&#8230;, .0): Unable to find element&#8221;\u3002<\/p>\n<p>\u9019\u500b\u932f\u8aa4\u901a\u5e38\u662f\u7531\u65bc\u5fd8\u8a18\u5728\u4f7f\u7528\u8868\u683c\u6642\u6dfb\u52a0 <\/p>\n<tbody>\uff0c\u6216\u8005\u5c07\u50cf<\/p>\n<p>&lt;<\/p>\n<p>form>\u3001<\/p>\n<p> \u6216 <a> \u7b49\u6a19\u7c64\u5d4c\u5957\uff0c\u6216\u8005\u5728 <svg> \u7236\u5143\u7d20\u4e2d\u4f7f\u7528\u975e SVG \u5143\u7d20\u6240\u5c0e\u81f4\u7684\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u8981\u89e3\u6c7a\u9019\u500b\u554f\u984c\uff0c\u958b\u767c\u8005\u9700\u8981\u6aa2\u67e5\u5143\u7d20\u7684\u5b50\u7bc0\u9ede\uff0c\u4e26\u78ba\u4fdd\u5b83\u5011\u662f\u6b63\u78ba\u7684\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f7f\u7528\u8868\u683c\uff0c\u5247\u5fc5\u9808\u78ba\u4fdd\u6bcf\u500b\u8868\u683c\u90fd\u6709 <\/p>\n<tbody> \u6a19\u7c64\u3002\u6b64\u5916\uff0c\u958b\u767c\u8005\u9084\u9700\u8981\u78ba\u4fdd\u4e0d\u8981\u5c07\u50cf<\/p>\n<p>&lt;<\/p>\n<p>form>\u3001<\/p>\n<p> \u6216 <a> \u7b49\u6a19\u7c64\u5d4c\u5957\uff0c\u4ee5\u53ca\u4e0d\u8981\u5728 <svg> \u7236\u5143\u7d20\u4e2d\u4f7f\u7528\u975e SVG \u5143\u7d20\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u958b\u767c\u8005\u9084\u53ef\u4ee5\u4f7f\u7528 React ID \u4f86\u6aa2\u67e5\u5143\u7d20\u7684\u5b50\u7bc0\u9ede\uff0c\u4ee5\u78ba\u4fdd\u5b83\u5011\u662f\u6b63\u78ba\u7684\u3002\u8981\u7372\u53d6 React ID\uff0c\u53ef\u4ee5\u4f7f\u7528 React Developer Tools \u64f4\u5c55\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u8f15\u9b06\u5730\u6aa2\u67e5\u5143\u7d20\u7684\u5b50\u7bc0\u9ede\u3002<\/p>\n<p>\u7e3d\u4e4b\uff0c\u8981\u89e3\u6c7a React.js &#8220;Error: Invariant Violation: findComponentRoot(&#8230;, .0): Unable to find element&#8221; \u932f\u8aa4\uff0c\u958b\u767c\u8005\u9700\u8981\u6aa2\u67e5\u5143\u7d20\u7684\u5b50\u7bc0\u9ede\uff0c\u4e26\u78ba\u4fdd\u5b83\u5011\u662f\u6b63\u78ba\u7684\u3002\u6b64\u5916\uff0c\u958b\u767c\u8005\u9084\u53ef\u4ee5\u4f7f\u7528 React ID \u4f86\u6aa2\u67e5\u5143\u7d20\u7684\u5b50\u7bc0\u9ede\uff0c\u4ee5\u78ba\u4fdd\u5b83\u5011\u662f\u6b63\u78ba\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u89e3\u6c7aReact.js\u4e2d\u300cInvariantViolation:findComponentRoot\u300d\u7684\u932f\u8aa4\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u6709\u7528\u7684\u6280\u5de7\uff0c\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u89e3\u6c7a\u6b64\u985e\u554f\u984c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[184,183],"tags":[182,181],"class_list":["post-4750","post","type-post","status-publish","format-standard","hentry","category-react","category-react-js","tag-react","tag-react-js"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1eC","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=4750"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4750\/revisions"}],"predecessor-version":[{"id":4751,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4750\/revisions\/4751"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}