{"id":4682,"date":"2023-01-04T17:32:53","date_gmt":"2023-01-04T09:32:53","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4682"},"modified":"2023-01-04T17:32:53","modified_gmt":"2023-01-04T09:32:53","slug":"%e8%a7%a3%e6%b1%bareact-js%e4%b8%ad%e7%9a%84%e3%80%8cinvalidvalueforpropkey%e3%80%8d%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%e7%9a%84%e3%80%8cinvalidvalueforpropkey%e3%80%8d%e9%8c%af%e8%aa%a4\/","title":{"rendered":"\u89e3\u6c7aReact.js\u4e2d\u7684\u300cInvalidvalueforpropkey\u300d\u932f\u8aa4"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React.js, Error, Invalid value, prop, Component, tag, string, number, value\"><\/p>\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\u5e38\u898b\u7684\u932f\u8aa4\u662f\uff1a\u201cError\uff1aInvalid value for prop key on <Component> tag. Either remove this prop from the element, or pass a string or number value to make it a valid prop.\u201d\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f prop key\uff1f<\/h2>\n<p>Prop key \u662f React.js \u4e2d\u7684\u4e00\u500b\u5c6c\u6027\uff0c\u5b83\u53ef\u4ee5\u7528\u65bc\u6307\u5b9a\u7d44\u4ef6\u7684\u5c6c\u6027\u503c\u3002\u5b83\u53ef\u4ee5\u662f\u5b57\u7b26\u4e32\u3001\u6578\u5b57\u6216\u5e03\u723e\u503c\uff0c\u4f46\u4e0d\u80fd\u662f\u5176\u4ed6\u985e\u578b\u7684\u503c\uff0c\u5426\u5247\u5c31\u6703\u51fa\u73fe\u4e0a\u8ff0\u932f\u8aa4\u3002<\/p>\n<h2>\u5982\u4f55\u89e3\u6c7a\u9019\u500b\u554f\u984c\uff1f<\/h2>\n<p>\u89e3\u6c7a\u9019\u500b\u554f\u984c\u7684\u6700\u7c21\u55ae\u65b9\u6cd5\u662f\u5c07 prop key \u7684\u503c\u66f4\u6539\u70ba\u5b57\u7b26\u4e32\u6216\u6578\u5b57\uff0c\u4ee5\u78ba\u4fdd\u5b83\u662f\u6709\u6548\u7684\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528\u4e00\u500b prop key \u4f86\u6307\u5b9a\u4e00\u500b\u7d44\u4ef6\u7684\u5c6c\u6027\u503c\uff0c\u4f60\u53ef\u4ee5\u5c07\u5b83\u66f4\u6539\u70ba\u5b57\u7b26\u4e32\u6216\u6578\u5b57\uff0c\u4ee5\u78ba\u4fdd\u5b83\u662f\u6709\u6548\u7684\u3002<\/p>\n<p>\u53e6\u4e00\u7a2e\u89e3\u6c7a\u8a72\u554f\u984c\u7684\u65b9\u6cd5\u662f\u5c07 prop key \u5f9e\u7d44\u4ef6\u4e2d\u522a\u9664\uff0c\u56e0\u70ba\u5b83\u4e0d\u662f\u5fc5\u9700\u7684\u3002\u4f46\u662f\uff0c\u5728\u522a\u9664\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u8a72\u7d44\u4ef6\u4e0d\u6703\u56e0\u6b64\u800c\u53d7\u5230\u5f71\u97ff\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>React.js \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684 JavaScript \u5eab\uff0c\u4f46\u5728\u4f7f\u7528\u5b83\u6642\uff0c\u958b\u767c\u8005\u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u5e38\u898b\u7684\u932f\u8aa4\u662f\uff1a\u201cError\uff1aInvalid value for prop key on <Component> tag. Either remove this prop from the element, or pass a string or number value to make it a valid prop.\u201d\u3002\u89e3\u6c7a\u8a72\u554f\u984c\u7684\u6700\u7c21\u55ae\u65b9\u6cd5\u662f\u5c07 prop key \u7684\u503c\u66f4\u6539\u70ba\u5b57\u7b26\u4e32\u6216\u6578\u5b57\uff0c\u4ee5\u78ba\u4fdd\u5b83\u662f\u6709\u6548\u7684\uff0c\u6216\u8005\u5c07 prop key \u5f9e\u7d44\u4ef6\u4e2d\u522a\u9664\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u89e3\u6c7aReact.js\u4e2d\u7684\u300cInvalidvalueforpropkey\u300d\u932f\u8aa4\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u6709\u7528\u7684\u6280\u5de7\uff0c\u8b93\u958b\u767c\u8005\u53ef\u4ee5\u66f4\u8f15\u9b06\u5730\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-4682","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-1dw","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4682","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=4682"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4682\/revisions"}],"predecessor-version":[{"id":4683,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4682\/revisions\/4683"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}