{"id":4538,"date":"2023-01-04T16:03:16","date_gmt":"2023-01-04T08:03:16","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4538"},"modified":"2023-01-04T16:03:16","modified_gmt":"2023-01-04T08:03:16","slug":"%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8react-js%e8%87%aa%e5%ae%9a%e7%be%a9%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8react-js%e8%87%aa%e5%ae%9a%e7%be%a9%e6%96%b9%e6%b3%95\/","title":{"rendered":"\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528React.js\u81ea\u5b9a\u7fa9\u65b9\u6cd5"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React, React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\"><\/p>\n<p>React \u662f\u4e00\u500b\u7531 Facebook \u6240\u958b\u767c\u7684 JavaScript \u51fd\u5f0f\u5eab\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u5efa\u7acb\u4e92\u52d5\u5f0f\u7684\u7db2\u9801\u61c9\u7528\u7a0b\u5f0f\u3002React \u80fd\u5920\u8b93\u958b\u767c\u8005\u8f15\u9b06\u5730\u5efa\u7acb\u81ea\u5b9a\u7fa9\u7684\u65b9\u6cd5\uff0c\u4ee5\u6eff\u8db3\u7279\u5b9a\u7684\u9700\u6c42\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528 React \u4f86\u5efa\u7acb\u81ea\u5b9a\u7fa9\u7684\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5982\u4f55\u5c07\u5b83\u5011\u61c9\u7528\u65bc\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002<\/p>\n<h2>React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\u662f\u4e00\u7a2e\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u81ea\u884c\u5b9a\u7fa9\u7684\u51fd\u5f0f\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u7279\u5b9a\u7684\u529f\u80fd\u6dfb\u52a0\u5230 React \u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u7279\u5b9a\u7684\u529f\u80fd\u6dfb\u52a0\u5230 React \u61c9\u7528\u7a0b\u5f0f\u4e2d\uff0c\u800c\u4e0d\u9700\u8981\u91cd\u65b0\u7de8\u5beb\u6574\u500b\u61c9\u7528\u7a0b\u5f0f\u3002<\/p>\n<h2>\u5982\u4f55\u5efa\u7acb React \u81ea\u5b9a\u7fa9\u65b9\u6cd5<\/h2>\n<p>\u8981\u5efa\u7acb React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff0c\u958b\u767c\u8005\u9700\u8981\u4f7f\u7528 JavaScript \u4f86\u5b9a\u7fa9\u51fd\u5f0f\uff0c\u4e26\u5c07\u5176\u5c01\u88dd\u5728 React \u7d44\u4ef6\u4e2d\u3002\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684\u7bc4\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u5efa\u7acb\u4e00\u500b React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff1a<\/p>\n<pre class=\"brush: javascript\">\nfunction myCustomFunction() {\n  \/\/ \u5728\u9019\u88e1\u5beb\u5165\u60a8\u7684\u81ea\u5b9a\u7fa9\u51fd\u5f0f\n}\n\nclass MyComponent extends React.Component {\n  render() {\n    return (\n      <div>\n        <h1>My Component<\/h1>\n        <button onClick={myCustomFunction}>Click Me!<\/button>\n      <\/div>\n    );\n  }\n}\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u7bc4\u4f8b\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e00\u500b\u540d\u70ba myCustomFunction \u7684\u51fd\u5f0f\uff0c\u4e26\u5c07\u5176\u5c01\u88dd\u5728 MyComponent \u7d44\u4ef6\u4e2d\u3002\u7576\u4f7f\u7528\u8005\u9ede\u64ca\u6309\u9215\u6642\uff0c\u5c31\u6703\u57f7\u884c myCustomFunction \u51fd\u5f0f\u3002<\/p>\n<h2>\u5982\u4f55\u5c07 React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\u61c9\u7528\u65bc\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u4e2d<\/h2>\n<p>\u4e00\u65e6\u60a8\u5efa\u7acb\u4e86 React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff0c\u60a8\u5c31\u53ef\u4ee5\u5c07\u5176\u61c9\u7528\u65bc\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002\u60a8\u53ef\u4ee5\u5c07\u81ea\u5b9a\u7fa9\u51fd\u5f0f\u6dfb\u52a0\u5230 React \u7d44\u4ef6\u4e2d\uff0c\u4e26\u5c07\u5176\u4f5c\u70ba\u53c3\u6578\u50b3\u905e\u7d66 React \u7d44\u4ef6\u3002<\/p>\n<pre class=\"brush: javascript\">\nfunction myCustomFunction() {\n  \/\/ \u5728\u9019\u88e1\u5beb\u5165\u60a8\u7684\u81ea\u5b9a\u7fa9\u51fd\u5f0f\n}\n\nclass MyComponent extends React.Component {\n  render() {\n    return (\n      <div>\n        <h1>My Component<\/h1>\n        <MyOtherComponent myCustomFunction={myCustomFunction} \/>\n      <\/div>\n    );\n  }\n}\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u7bc4\u4f8b\u4e2d\uff0c\u6211\u5011\u5c07 myCustomFunction \u51fd\u5f0f\u4f5c\u70ba\u53c3\u6578\u50b3\u905e\u7d66 MyOtherComponent \u7d44\u4ef6\u3002MyOtherComponent \u7d44\u4ef6\u5c31\u53ef\u4ee5\u4f7f\u7528 myCustomFunction \u51fd\u5f0f\u4f86\u57f7\u884c\u7279\u5b9a\u7684\u64cd\u4f5c\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\u662f\u4e00\u7a2e\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u81ea\u884c\u5b9a\u7fa9\u7684\u51fd\u5f0f\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5c07\u7279\u5b9a\u7684\u529f\u80fd\u6dfb\u52a0\u5230 React \u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002\u8981\u5efa\u7acb React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff0c\u958b\u767c\u8005\u9700\u8981\u4f7f\u7528 JavaScript \u4f86\u5b9a\u7fa9\u51fd\u5f0f\uff0c\u4e26\u5c07\u5176\u5c01\u88dd\u5728 React \u7d44\u4ef6\u4e2d\u3002\u4e00\u65e6\u60a8\u5efa\u7acb\u4e86 React \u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff0c\u60a8\u5c31\u53ef\u4ee5\u5c07\u5176\u61c9\u7528\u65bc\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u4e2d\uff0c\u4e26\u5c07\u5176\u4f5c\u70ba\u53c3\u6578\u50b3\u905e\u7d66 React \u7d44\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528React.js\u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8b93\u4f60\u66f4\u6709\u6548\u7387\u5730\u958b\u767c\u61c9\u7528\u7a0b\u5f0f\uff0c\u4e26\u63d0\u9ad8\u7a0b\u5f0f\u78bc\u7684\u53ef\u8b80\u6027\u548c\u53ef\u7dad\u8b77\u6027\u3002\u672c\u6587\u5c07\u4ecb\u7d39React.js\u4e2d\u7684\u81ea\u5b9a\u7fa9\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u5011\u4f86\u63d0\u9ad8\u958b\u767c\u6548\u7387\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-4538","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-1bc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4538","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=4538"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4538\/revisions"}],"predecessor-version":[{"id":4539,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4538\/revisions\/4539"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}