{"id":5755,"date":"2023-01-06T14:54:52","date_gmt":"2023-01-06T06:54:52","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5755"},"modified":"2023-01-06T14:54:52","modified_gmt":"2023-01-06T06:54:52","slug":"%e4%ba%86%e8%a7%a3react%e4%b8%ad%e7%9a%84%e7%b4%94%e7%b5%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/%e4%ba%86%e8%a7%a3react%e4%b8%ad%e7%9a%84%e7%b4%94%e7%b5%84%e4%bb%b6\/","title":{"rendered":"\u4e86\u89e3React\u4e2d\u7684\u7d14\u7d44\u4ef6"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React, \u7eaf\u7ec4\u4ef6\"><\/p>\n<h1>\u89e3\u91cb React \u4e2d\u7684\u7eaf\u7ec4\u4ef6<\/h1>\n<p>React \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\u7528\u6236\u754c\u9762\u3002React \u4e2d\u7684\u7eaf\u7ec4\u4ef6\u662f\u4e00\u7a2e\u7279\u6b8a\u7684\u7d44\u4ef6\uff0c\u5b83\u50c5\u63a5\u53d7 props\uff0c\u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f\u7eaf\u7ec4\u4ef6\uff1f<\/h2>\n<p>\u7eaf\u7ec4\u4ef6\u662f\u4e00\u7a2e\u7279\u6b8a\u7684 React \u7d44\u4ef6\uff0c\u5b83\u53ea\u63a5\u53d7 props\uff0c\u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002\u5b83\u4e0d\u6703\u4fdd\u5b58\u72c0\u614b\uff0c\u4e5f\u4e0d\u6703\u8a02\u95b1\u4efb\u4f55\u5916\u90e8\u6578\u64da\u6e90\uff0c\u4e5f\u4e0d\u6703\u89f8\u767c\u4efb\u4f55\u526f\u4f5c\u7528\u3002\u5b83\u5011\u53ea\u662f\u4e00\u500b\u51fd\u6578\uff0c\u63a5\u53d7 props \u4f5c\u70ba\u53c3\u6578\uff0c\u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002<\/p>\n<p>\u7eaf\u7ec4\u4ef6\u7684\u6700\u5927\u512a\u52e2\u662f\u5b83\u5011\u53ef\u4ee5\u88ab\u55ae\u7368\u6e2c\u8a66\uff0c\u4e26\u4e14\u53ef\u4ee5\u88ab\u5feb\u901f\u6e32\u67d3\u3002\u5b83\u5011\u4e5f\u53ef\u4ee5\u88ab\u91cd\u7528\uff0c\u56e0\u70ba\u5b83\u5011\u4e0d\u6703\u4fdd\u5b58\u72c0\u614b\uff0c\u4e5f\u4e0d\u6703\u8a02\u95b1\u4efb\u4f55\u5916\u90e8\u6578\u64da\u6e90\u3002<\/p>\n<h2>\u7eaf\u7ec4\u4ef6\u7684\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u7eaf\u7ec4\u4ef6\u793a\u4f8b\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconst MyComponent = (props) => {\n  return (\n    <div>\n      <h1>{props.title}<\/h1>\n      {props.description}\n    <\/div>\n  );\n};\n<\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0cMyComponent \u63a5\u53d7\u4e00\u500b props \u53c3\u6578\uff0c\u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002\u5b83\u4e0d\u6703\u4fdd\u5b58\u72c0\u614b\uff0c\u4e5f\u4e0d\u6703\u8a02\u95b1\u4efb\u4f55\u5916\u90e8\u6578\u64da\u6e90\uff0c\u4e5f\u4e0d\u6703\u89f8\u767c\u4efb\u4f55\u526f\u4f5c\u7528\u3002<\/p>\n<h2>\u70ba\u4ec0\u9ebc\u4f7f\u7528\u7eaf\u7ec4\u4ef6\uff1f<\/h2>\n<p>\u7eaf\u7ec4\u4ef6\u7684\u6700\u5927\u512a\u52e2\u662f\u5b83\u5011\u53ef\u4ee5\u88ab\u55ae\u7368\u6e2c\u8a66\uff0c\u4e26\u4e14\u53ef\u4ee5\u88ab\u5feb\u901f\u6e32\u67d3\u3002\u5b83\u5011\u4e5f\u53ef\u4ee5\u88ab\u91cd\u7528\uff0c\u56e0\u70ba\u5b83\u5011\u4e0d\u6703\u4fdd\u5b58\u72c0\u614b\uff0c\u4e5f\u4e0d\u6703\u8a02\u95b1\u4efb\u4f55\u5916\u90e8\u6578\u64da\u6e90\u3002\u6b64\u5916\uff0c\u5b83\u5011\u53ef\u4ee5\u6e1b\u5c11\u7d44\u4ef6\u7684\u8907\u96dc\u6027\uff0c\u56e0\u70ba\u5b83\u5011\u53ea\u9700\u8981\u63a5\u53d7 props \u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>React \u4e2d\u7684\u7eaf\u7ec4\u4ef6\u662f\u4e00\u7a2e\u7279\u6b8a\u7684\u7d44\u4ef6\uff0c\u5b83\u50c5\u63a5\u53d7 props\uff0c\u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002\u5b83\u5011\u53ef\u4ee5\u88ab\u55ae\u7368\u6e2c\u8a66\uff0c\u4e26\u4e14\u53ef\u4ee5\u88ab\u5feb\u901f\u6e32\u67d3\uff0c\u4e26\u4e14\u53ef\u4ee5\u88ab\u91cd\u7528\uff0c\u56e0\u70ba\u5b83\u5011\u4e0d\u6703\u4fdd\u5b58\u72c0\u614b\uff0c\u4e5f\u4e0d\u6703\u8a02\u95b1\u4efb\u4f55\u5916\u90e8\u6578\u64da\u6e90\u3002\u6b64\u5916\uff0c\u5b83\u5011\u53ef\u4ee5\u6e1b\u5c11\u7d44\u4ef6\u7684\u8907\u96dc\u6027\uff0c\u56e0\u70ba\u5b83\u5011\u53ea\u9700\u8981\u63a5\u53d7 props \u4e26\u8fd4\u56de\u4e00\u500b React \u5143\u7d20\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u8a73\u7d30\u89e3\u91cbReact\u4e2d\u7684\u7d14\u7d44\u4ef6\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u6709\u7528\u7684\u6280\u5de7\uff0c\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528\u5b83\u5011\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-5755","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-1uP","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5755","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=5755"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5755\/revisions"}],"predecessor-version":[{"id":5756,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5755\/revisions\/5756"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}