{"id":6476,"date":"2023-01-08T21:10:44","date_gmt":"2023-01-08T13:10:44","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=6476"},"modified":"2023-01-08T21:10:44","modified_gmt":"2023-01-08T13:10:44","slug":"%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8react-js%e5%b0%8dreactlist%e9%80%b2%e8%a1%8c%e5%8f%8d%e8%bd%ac-2","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%e5%b0%8dreactlist%e9%80%b2%e8%a1%8c%e5%8f%8d%e8%bd%ac-2\/","title":{"rendered":"\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528React.JS\u5c0dReactList\u9032\u884c\u53cd\u8f6c"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React, React List, Reverse\"><\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 React.JS \u5c0d React List \u9032\u884c\u53cd\u8f6c\uff1f<\/h1>\n<p>React.JS \u662f\u4e00\u500b\u7528\u65bc\u69cb\u5efa\u7528\u6236\u7aef\u61c9\u7528\u7a0b\u5e8f\u7684 JavaScript \u5eab\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u69cb\u5efa\u51fa\u9ad8\u6027\u80fd\u7684\u61c9\u7528\u7a0b\u5e8f\u3002\u5728 React.JS \u4e2d\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u4f7f\u7528 React List \u4f86\u7ba1\u7406\u5217\u8868\u6578\u64da\uff0c\u4f46\u662f\u6709\u6642\u5019\u6211\u5011\u9700\u8981\u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u90a3\u9ebc\u8a72\u5982\u4f55\u505a\u5462\uff1f\u672c\u6587\u5c07\u70ba\u60a8\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528 React.JS \u5c0d React List \u9032\u884c\u53cd\u8f6c\u3002<\/p>\n<h2>\u4f7f\u7528 Array.prototype.reverse() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c<\/h2>\n<p>Array.prototype.reverse() \u65b9\u6cd5\u53ef\u4ee5\u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u5b83\u6703\u5c07 React List \u4e2d\u7684\u5143\u7d20\u9806\u5e8f\u53cd\u8f6c\uff0c\u4e26\u4e14\u8fd4\u56de\u4e00\u500b\u65b0\u7684\u53cd\u8f6c\u5f8c\u7684 React List\u3002<\/p>\n<pre class=\"brush: javascript\">\n\/\/ \u5b9a\u7fa9\u4e00\u500b React List\nlet list = [1, 2, 3, 4, 5];\n\n\/\/ \u4f7f\u7528 Array.prototype.reverse() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c\nlet reversedList = list.reverse();\n\n\/\/ \u8f38\u51fa\u53cd\u8f6c\u5f8c\u7684 React List\nconsole.log(reversedList); \/\/ [5, 4, 3, 2, 1]\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e00\u500b React List\uff0c\u7136\u5f8c\u4f7f\u7528 Array.prototype.reverse() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u6700\u5f8c\u8f38\u51fa\u53cd\u8f6c\u5f8c\u7684 React List\u3002<\/p>\n<h2>\u4f7f\u7528 Array.prototype.map() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c<\/h2>\n<p>Array.prototype.map() \u65b9\u6cd5\u4e5f\u53ef\u4ee5\u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u5b83\u6703\u5c07 React List \u4e2d\u7684\u5143\u7d20\u9806\u5e8f\u53cd\u8f6c\uff0c\u4e26\u4e14\u8fd4\u56de\u4e00\u500b\u65b0\u7684\u53cd\u8f6c\u5f8c\u7684 React List\u3002<\/p>\n<pre class=\"brush: javascript\">\n\/\/ \u5b9a\u7fa9\u4e00\u500b React List\nlet list = [1, 2, 3, 4, 5];\n\n\/\/ \u4f7f\u7528 Array.prototype.map() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c\nlet reversedList = list.map((item, index, array) => {\n  return array[array.length - index - 1];\n});\n\n\/\/ \u8f38\u51fa\u53cd\u8f6c\u5f8c\u7684 React List\nconsole.log(reversedList); \/\/ [5, 4, 3, 2, 1]\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e00\u500b React List\uff0c\u7136\u5f8c\u4f7f\u7528 Array.prototype.map() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u6700\u5f8c\u8f38\u51fa\u53cd\u8f6c\u5f8c\u7684 React List\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528 React.JS \u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u53ef\u4ee5\u4f7f\u7528 Array.prototype.reverse() \u65b9\u6cd5\u6216\u8005 Array.prototype.map() \u65b9\u6cd5\u5c0d React List \u9032\u884c\u53cd\u8f6c\uff0c\u4e26\u4e14\u8fd4\u56de\u4e00\u500b\u65b0\u7684\u53cd\u8f6c\u5f8c\u7684 React List\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u66f4\u591a\u5167\u5bb9<\/h2>\n<p>\u5982\u679c\u60a8\u60f3\u4e86\u89e3\u66f4\u591a\u95dc\u65bc React.JS \u7684\u77e5\u8b58\uff0c\u8acb\u700f\u89bd <a style=\"color: #0099cc;\" href=\"https:\/\/www.example.com\/\" target=\"_blank\" rel=\"noopener\">\u6211\u5011\u7684\u7db2\u7ad9<\/a>\uff0c\u6211\u5011\u6703\u63d0\u4f9b\u66f4\u591a\u6709\u95dc React.JS \u7684\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528React.JS\u5c0dReactList\u9032\u884c\u53cd\u8f6c\uff0c\u8b93\u958b\u767c\u8005\u53ef\u4ee5\u66f4\u8f15\u9b06\u5730\u5c0dReactList\u9032\u884c\u64cd\u4f5c\uff0c\u4e26\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-6476","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-1Gs","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6476","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=6476"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6476\/revisions"}],"predecessor-version":[{"id":6477,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6476\/revisions\/6477"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=6476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=6476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=6476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}