{"id":5761,"date":"2023-01-06T14:56:12","date_gmt":"2023-01-06T06:56:12","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5761"},"modified":"2023-01-06T14:56:12","modified_gmt":"2023-01-06T06:56:12","slug":"%e4%bd%bf%e7%94%a8react-js%e6%b1%82%e5%8f%96reactlist%e7%9a%84%e5%b9%b3%e5%9d%87%e5%80%bc","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/%e4%bd%bf%e7%94%a8react-js%e6%b1%82%e5%8f%96reactlist%e7%9a%84%e5%b9%b3%e5%9d%87%e5%80%bc\/","title":{"rendered":"\u4f7f\u7528React.JS\u6c42\u53d6ReactList\u7684\u5e73\u5747\u503c"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React, React List, meanValue\"><\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 React.JS \u6c42 React List \u7684\u5e73\u5747\u503c(meanValue)<\/h1>\n<p>React.JS \u662f\u4e00\u500b\u7528\u65bc\u69cb\u5efa\u7528\u6236\u7aef\u61c9\u7528\u7a0b\u5e8f\u7684 JavaScript \u6846\u67b6\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u69cb\u5efa\u51fa\u9ad8\u54c1\u8cea\u7684\u7528\u6236\u7aef\u61c9\u7528\u7a0b\u5e8f\u3002\u5728 React.JS \u4e2d\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u4f7f\u7528 React List \u4f86\u5b58\u5132\u6578\u64da\uff0c\u800c\u6c42\u51fa React List \u7684\u5e73\u5747\u503c(meanValue)\u4e5f\u662f\u4e00\u500b\u5e38\u898b\u7684\u4efb\u52d9\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa React List \u7684\u5e73\u5747\u503c(meanValue)\u3002<\/p>\n<h2>\u4f7f\u7528 React.JS \u6c42 React List \u7684\u5e73\u5747\u503c(meanValue)<\/h2>\n<p>\u9996\u5148\uff0c\u6211\u5011\u9700\u8981\u5b9a\u7fa9\u4e00\u500b React List\uff0c\u4e26\u5c07\u6578\u64da\u6dfb\u52a0\u5230\u5176\u4e2d\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconst list = [1, 2, 3, 4, 5];\n<\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u53ef\u4ee5\u4f7f\u7528 JavaScript \u7684 reduce() \u65b9\u6cd5\u4f86\u6c42\u51fa React List \u7684\u5e73\u5747\u503c(meanValue)\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconst meanValue = list.reduce((acc, curr) => acc + curr) \/ list.length;\n<\/pre>\n<p>\u6700\u5f8c\uff0c\u6211\u5011\u53ef\u4ee5\u4f7f\u7528 console.log() \u65b9\u6cd5\u4f86\u67e5\u770b React List \u7684\u5e73\u5747\u503c(meanValue)\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconsole.log(meanValue); \/\/ 3\n<\/pre>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 React.JS \u6c42 React List \u7684\u5e73\u5747\u503c(meanValue)\u7684\u5b8c\u6574\u6b65\u9a5f\u3002\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa React List \u7684\u5e73\u5747\u503c(meanValue)\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5feb\u901f\u5730\u5b8c\u6210\u4efb\u52d9\uff0c\u800c\u4e14\u9084\u53ef\u4ee5\u6e1b\u5c11\u7a0b\u5e8f\u78bc\u7684\u8907\u96dc\u5ea6\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u672c\u6587\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528 React.JS \u6c42 React List \u7684\u5e73\u5747\u503c(meanValue)\u7684\u5b8c\u6574\u6b65\u9a5f\u3002\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa React List \u7684\u5e73\u5747\u503c(meanValue)\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5feb\u901f\u5730\u5b8c\u6210\u4efb\u52d9\uff0c\u800c\u4e14\u9084\u53ef\u4ee5\u6e1b\u5c11\u7a0b\u5e8f\u78bc\u7684\u8907\u96dc\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528React.JS\u4f86\u6c42\u53d6ReactList\u7684\u5e73\u5747\u503c\uff0c\u4e26\u63d0\u4f9b\u7c21\u55ae\u6613\u61c2\u7684\u7a0b\u5f0f\u78bc\u793a\u4f8b\uff0c\u8b93\u8b80\u8005\u53ef\u4ee5\u8f15\u9b06\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528React.JS\u4f86\u8a08\u7b97\u5e73\u5747\u503c\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-5761","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-1uV","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5761","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=5761"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5761\/revisions"}],"predecessor-version":[{"id":5762,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5761\/revisions\/5762"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}