{"id":5562,"date":"2016-11-28T10:25:28","date_gmt":"2016-11-28T02:25:28","guid":{"rendered":"https:\/\/sdeno.com\/?p=5562"},"modified":"2016-11-28T10:57:51","modified_gmt":"2016-11-28T02:57:51","slug":"react-native%e7%94%9f%e5%91%bd%e5%91%a8%e6%9c%9f","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=5562","title":{"rendered":"react native\u751f\u547d\u5468\u671f"},"content":{"rendered":"<a href=\"https:\/\/sdeno.com\/?attachment_id=5566\" rel=\"attachment wp-att-5566\"><figure class=\"mdx-lazyload-container\" style=\"max-width:1298px\"><div style=\"padding-top:68.875192604006%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"1298\" height=\"894\" class=\"alignnone size-full wp-image-5566 lazyload\" title=\"nrzhouqi\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2016\/11\/nrzhouqi.png\" alt=\"nrzhouqi\"><\/figure><\/a>\n<p>getDefaultProps() \/\/\u83b7\u53d6\u521d\u59cb\u7684\u914d\u7f6e\u53c2\u6570\uff0c\u4e00\u822c\u914d\u7f6e\u53c2\u6570\u90fd\u662f\u9884\u5148\u8bbe\u7f6e\u597d\u7684\uff08react native\u9ed8\u8ba4\u914d\u7f6e\uff09<\/p>\n<p>\u4f8b\u5982\uff0c\u7528\u6237\u70b9\u51fbapp\u7b2c\u4e00\u6b21\u8fdb\u5165\u9996\u9875\u65f6\u53d1\u751f\u4e86\u4ee5\u4e0b\u6b65\u9aa4<br \/>\ngetInitialState() \/\/\u83b7\u53d6\u521d\u59cb\u7684\u72b6\u6001\u503c\uff0c\u4f1a\u53d1\u751f\u53d8\u5316\u7684\u6570\u636e\u653e\u5165\u91cc\u9762 \uff08\u8bbe\u7f6e\u9ed8\u8ba4\u521d\u59cb\u503c\uff09<br \/>\ncomponentWillMount() \/\/\u5728\u6e32\u67d3\u663e\u793a\u89c6\u56fe\u4e4b\u524d\u8981\u6267\u884c\u7684\u51fd\u6570\u65b9\u6cd5\uff0c\u5176\u5b9e\u5c31\u662f\u628a\u4e4b\u524d\u8bbe\u7f6e\u7684\u503c\u83b7\u53d6\u5230 \uff08\u663e\u793a\u89c6\u56fe\u6a21\u5f0f\u4e4b\u524d\u7684\u56de\u8c03\uff09<br \/>\nrender() \/\/\u7ecf\u8fc7\u4e86componentWillMount\u540e\u5c31\u5f00\u59cb\u663e\u793a\u89c6\u56fe\u6a21\u578b\u4e86 \uff08\u663e\u793a\u89c6\u56fe\uff09<br \/>\ncomponentDidMount() \/\/\u89c6\u56fe\u6e32\u67d3\u5b8c\u6210\u540e\uff0c\u8981\u53d1\u751f\u7684\u56de\u8c03 \uff08\u663e\u793a\u89c6\u56fe\u540e\u7684\u56de\u8c03\uff09<\/p>\n<p>\u4ee5\u4e0a\u987a\u5e8f\u5c31\u662f\u5f53\u624b\u673a\u5237\u65b0\u7b2c\u4e00\u6b21\u7528\u6237\u770b\u5230\u9875\u9762\u65f6\uff0c\u8c03\u7528\u5230\u7684\u51fd\u6570\u3002<br \/>\n\u9875\u9762\u4e0d\u53ef\u80fd\u4e00\u70b9\u90fd\u4e0d\u53d8\u5316\uff0c\u4f8b\u5982\u70b9\u51fb\u5206\u9875\uff0c\u9875\u9762\u8df3\u8f6c\u603b\u4f1a\u53d1\u751f\u53d8\u5316\uff0c\u4e5f\u5c31\u662f\u72b6\u6001\u4f1a\u53d1\u751f\u53d8\u5316\u3002\u4f8b\u5982\uff0c\u7528\u6237\u70b9\u51fb\u5206\u98752\u65f6\u53d1\u751f\u5982\u4e0b\u6b65\u9aa4<\/p>\n<p>&nbsp;<\/p>\n<p>\u9875\u9762\u53d1\u751f\u6539\u53d8\u65f6\u60c5\u51b5\u4e00\uff1a<br \/>\nshouldComponentUpdate() \/\/\u72b6\u6001\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u5c31\u89e6\u53d1\u6b64\u51fd\u6570 \uff08\u4fee\u6539\u4e4b\u524dgetInitialState\u91cc\u9762\u7684\u503c\uff09<br \/>\ncomponentWillUpdate() \/\/shouldComponentUpdate\u51fd\u6570\u786e\u5b9a\u89e6\u53d1\u65f6\uff0c\u6b64\u51fd\u6570\u624d\u4f1a\u89e6\u53d1,\u8fd9\u91cc\u5fc5\u987b\u8fd4\u56de\u5e03\u5c14\u503c\uff0c\u5426\u5219\u4f1a\u51fa\u9519<br \/>\nrender() \/\/\u663e\u793a\u89c6\u56fe \uff08\u9875\u9762\u53d1\u751f\u66f4\u65b0\uff09<br \/>\ncomponentDidUpdate() \/\/\u66f4\u65b0\u540e\u7684\u56de\u8c03<\/p>\n<p>&nbsp;<\/p>\n<p>\u9875\u9762\u53d1\u751f\u6539\u53d8\u662f\u60c5\u51b5\u4e8c\uff1a\uff08\u5916\u90e8\u4f20\u5165\u53c2\u6570\u65f6\uff09<br \/>\n\u5916\u90e8\u4f20\u5165\u53c2\u6570\u65f6\uff0c\u5916\u90e8props\u6539\u53d8<br \/>\ncomponentWillReceiveProps() \/\/\u5916\u90e8\u7684props\u6539\u53d8\u65f6\u5c31\u89e6\u53d1\u6b64\u51fd\u6570<br \/>\nshouldComponentUpdate()<br \/>\ncomponentWillUpdate()<br \/>\nrender()<br \/>\ncomponentDidUpdate()<\/p>\n<p>&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\u7236\u3001\u5b50\u7ec4\u4ef6\u5d4c\u5957\u4e4b\u95f4\u7684\u5173\u7cfb&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>\u5f53\u5b50\u6a21\u677f\u5d4c\u5957\u5728\u7236\u6a21\u677f\u65f6\uff0c\u67e5\u770b\u4e2a\u4e2a\u5468\u671f\u90fd\u6267\u884c\u7684\u5148\u540e\u987a\u5e8f\uff1a<\/p>\n<p>\u521d\u6b21\u52a0\u8f7d\u9875\u9762\u65f6\uff1a<\/p>\n<a href=\"https:\/\/sdeno.com\/?attachment_id=5567\" rel=\"attachment wp-att-5567\"><figure class=\"mdx-lazyload-container\" style=\"max-width:370px\"><div style=\"padding-top:164.32432432432%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"370\" height=\"608\" class=\"alignnone size-full wp-image-5567 lazyload\" title=\"rnzhou1\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2016\/11\/rnzhou1.png\" alt=\"rnzhou1\"><\/figure><\/a>\n<p>&nbsp;<\/p>\n<p>\u754c\u9762\u6539\u53d8\u65f6\uff1a<\/p>\n<a href=\"https:\/\/sdeno.com\/?attachment_id=5568\" rel=\"attachment wp-att-5568\"><figure class=\"mdx-lazyload-container\" style=\"max-width:1120px\"><div style=\"padding-top:29.642857142857%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"1120\" height=\"332\" class=\"alignnone size-full wp-image-5568 lazyload\" title=\"rnzhou2\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2016\/11\/rnzhou2.png\" alt=\"rnzhou2\"><\/figure><\/a>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>getDefaultProps() \/\/\u83b7\u53d6\u521d\u59cb\u7684\u914d\u7f6e\u53c2\u6570\uff0c\u4e00\u822c\u914d\u7f6e\u53c2\u6570\u90fd\u662f\u9884\u5148\u8bbe\u7f6e\u597d\u7684\uff08react nati [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-5562","post","type-post","status-publish","format-standard","hentry","category-react-native"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5562"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5562\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}