{"id":322888,"date":"2021-02-05T21:16:20","date_gmt":"2021-02-05T13:16:20","guid":{"rendered":"http:\/\/4563.org\/?p=322888"},"modified":"2021-02-05T21:16:20","modified_gmt":"2021-02-05T13:16:20","slug":"%e6%9c%89%e6%b2%a1%e6%9c%89%e5%89%8d%e7%ab%af-react-%e8%af%b7%e6%95%99%e4%b8%aa%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=322888","title":{"rendered":"\u6709\u6ca1\u6709\u524d\u7aef react \u8bf7\u6559\u4e2a\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6709\u6ca1\u6709\u524d\u7aef react \u8bf7\u6559\u4e2a\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : RuiQ <\/span>  <span><i><\/i> 9<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u80cc\u666f\uff1a \u4e0d\u4f1a\u524d\u7aef\uff0c\u8d1f\u8d23\u7684\u9879\u76ee\u6ca1\u6709\u524d\u7aef\uff0c\u6240\u4ee5\u4e5f\u5199\u5199\u524d\u7aef<\/p>\n<p>\u95ee\u9898\uff1a \u662f props \u4f20\u503c\u65f6\u5019\uff0c\u503c\u662f\u540e\u7aef\u8fd4\u56de\u7684 \u683c\u5f0f\u662f<\/p>\n<pre><code>{ \"week\": {  \"sub_value\": [{   \"title\": \"\u661f\u671f\u4e00\",   \"value\": \"1\"  }, {   \"title\": \"\u661f\u671f\u4e8c\",   \"value\": \"2\"   }]  } } <\/code><\/pre>\n<p>\u7136\u540e\u7528 props \u4f20\u5230\u4e0b\u4e2a\u9875\u9762\u7684\u65f6\u5019\u683c\u5f0f\u53d8\u6210\u4e86\uff1a<\/p>\n<pre><code>{ \"week\": {  \"sub_value\": [{   \"title\": [\"\u661f\u671f\u4e00\", \"\u661f\u671f\u4e8c\"],   \"value\": [\"1\", \"2\"]  }] } }  <\/code><\/pre>\n<p>\u5176\u5b9e json \u7684\u5c42\u7ea7\u6bd4\u8f83\u6df1\uff0c\u9009\u53d6\u540e\u9762\u683c\u5f0f\u53d8\u5316\u7684\u4e3b\u8981\u90e8\u5206\uff0c\u4e5f\u4e0d\u77e5\u9053\u8ddf\u5c42\u7ea7\u8fc7\u6df1\u662f\u5426\u6709\u5173\u7cfb \u770b\u4e86\u4e0b \u4e2d\u95f4\u6ca1\u6709\u6570\u636e\u5904\u7406\u554a \u662f\u6211\u6ca1\u627e\u5230 \u8fd8\u662f\u6709\u4ec0\u4e48\u6f5c\u5728\u7684\u89c4\u5219<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>7<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4980813\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dcbryant <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6b63\u5e38\u60c5\u51b5\u4e0b\u6570\u636e\u7ed3\u6784\u80af\u5b9a\u4e0d\u4f1a\u53d8\uff0c\u6ca1\u770b\u4f60\u7684\u4ee3\u7801\u4e0d\u597d\u5206\u6790\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980814\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RuiQ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dcbryant \u597d\u7684 \u8c22\u8c22 \u5982\u679c\u4e0d\u662f\u56e0\u4e3a props \u6709\u6211\u672a\u77e5\u7684\u7279\u6027\u5bfc\u81f4\u7684 \u90a3\u5c31\u662f\u6211\u7684\u4ee3\u7801\u5904\u7406\u7684 \u90a3\u6211\u53ea\u8981\u4e00\u6b65\u6b65\u6392\u67e5\u5c31\u597d\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980815\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : TabGre <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u822c props \u4f20\u9012\u4e0d\u4f1a\u6539\u53d8\u6570\u636e\u7ed3\u6784\u7684\uff0c\u4f46\u662f\u5426\u53ef\u80fd\u662f\u4ec0\u4e48\u9ad8\u7ea7\u7684\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u5462\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980816\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : across <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u628a\u5355\u4e2a props \u5bf9\u8c61\u770b\u6210\u4e00\u4e2a\u5f15\u7528\u5bf9\u8c61\uff0c\u91cc\u9762\u503c\u53d8\u4e86\u4e0d\u4f1a\u89e6\u53d1\u5237\u65b0\u3002 \u53ea\u6709\u6307\u9488\u53d8\u4e86\u624d\u4f1a\u91cd\u65b0\u6e32\u67d3\u3002 \u4f30\u8ba1\u5c31\u662f\u5185\u90e8\u81ea\u5df1\u6539\u4e86\u503c\u6ca1\u76d1\u6d4b\u5230\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980817\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hugebug <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u540c\u610f\u6392\u67e5\u81ea\u5df1\u7684\u4ee3\u7801 \u6ca1\u89c1\u8fc7\u8fd9\u4e48\u5947\u602a\u7684\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980818\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Egg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u5728\u5b50\u7236\u7ec4\u4ef6\u7684 render console \u4e00\u4e0b \u770b\u4e0b\u662f\u54ea\u91cc\u7684\u95ee\u9898 \u6216\u8005\u5728\u5b50\u7ec4\u4ef6\u7684 componentWillMount || getDerivedStateFromProps \u8fd9\u4e24\u4e2a\u751f\u547d\u5468\u671f\u91cc\u9762 console \u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980819\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaojiqiaozhi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u770b\u4e0b\u7ec4\u4ef6\u5916\u9762\u6709\u6ca1\u6709\u5305\u88c5\u9970\u5668\u6216\u5176\u4ed6\u9ad8\u9636\u7ec4\u4ef6\uff0c\u6709\u53ef\u80fd props \u7684\u503c\u88ab\u9ad8\u9636\u7ec4\u4ef6\u4fee\u6539\u4e86\u3002<br \/>2. \u6ce8\u91ca\u5f53\u524d\u7ec4\u4ef6\u7684\u6240\u6709\u4ee3\u7801\uff0c\u5199\u4e2a\u7eaf\u51fd\u6570\u3002\u5206\u522b\u5728\u7236\u7ec4\u4ef6\u548c\u7eaf\u51fd\u6570\u4e2d\u6253\u5370 props \u7684\u503c\uff0c\u6253\u5370\u65f6\u4f7f\u7528 JSON.stringify \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u6ca1\u6709\u524d\u7aef react \u8bf7\u6559\u4e2a\u95ee\u9898&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/322888"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=322888"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/322888\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322888"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}