{"id":211,"date":"2021-02-10T10:20:30","date_gmt":"2021-02-10T02:20:30","guid":{"rendered":"http:\/\/gjweb.top\/?p=211"},"modified":"2021-09-24T21:33:21","modified_gmt":"2021-09-24T13:33:21","slug":"class%e7%bb%84%e4%bb%b6%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=211","title":{"rendered":"class\u7ec4\u4ef6\u8be6\u89e3"},"content":{"rendered":"\n<ol class=\"wp-block-list\"><li>class\u7ec4\u4ef6\u7684\u521b\u5efa\u65b9\u5f0f<\/li><li>\u7c7b\u7ec4\u4ef6\u4e2dprops\u7684\u4f7f\u7528<\/li><li>\u7c7b\u7ec4\u4ef6\u4e2dstate\u7684\u4f7f\u7528<\/li><li>\u7c7b\u7ec4\u4ef6\u7684\u751f\u547d\u5468\u671f<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">1. class\u7ec4\u4ef6\u7684\u521b\u5efa\u65b9\u5f0f<\/h2>\n\n\n\n<p>class\u7ec4\u4ef6\u4e5f\u53eb\u4f5c\u7c7b\u7ec4\u4ef6,\u6709\u4e24\u79cd\u521b\u5efa\u65b9\u5f0f,\u7b2c\u4e00\u79cd\u4e3aEs5,\u7b2c\u4e8c\u4e2d\u8bd5Es6\u65b9\u5f0f.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Es5\u521b\u5efa\u65b9\u5f0f<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;import React from \"react\"<br> &nbsp; &nbsp;const A = React.createClass({<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return (<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;hello wrold&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  })<br> &nbsp; &nbsp;export default A<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Es6\u521b\u5efa\u65b9\u5f0f<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;import React from \"react\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;class B extends React.Component{<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(props){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(props)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;retrun (<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;hello wrold&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br> &nbsp; &nbsp;export default B;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u7c7b\u7ec4\u4ef6\u4e2dprops\u7684\u4f7f\u7528<\/h2>\n\n\n\n<p><strong>props<\/strong>\u5916\u90e8\u6570\u636e,\u6307\u7684\u662f\u7236\u7ec4\u4ef6\u4f20\u9012\u7ed9\u5b50\u7ec4\u4ef6\u7684\u503c\u6216\u8005\u51fd\u6570, ==\u6ce8\u610f:<strong>props<\/strong>\u4e2d\u4e0d\u5141\u8bb8\u5b50\u7ec4\u4ef6\u4fee\u6539\u7236\u7ec4\u4ef6\u7684\u503c==<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;import React from \"react\"<br> &nbsp; &nbsp;class App extends React.Component {<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(porps){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(porps)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.state &nbsp;={<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;num:0<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  };<br> &nbsp; &nbsp; &nbsp; &nbsp;add = ()=&gt;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.state((state)=&gt;({state.num:num+1}))<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;APP<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;P&gt;{this.state.num}&lt;\/p&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;button onClick={this.add}&gt;add&lt;\/button&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;Child number={this.state.num}&gt;&lt;\/Child&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;class Child exentds Reach.Component{<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(props){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(props)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;\u5b50\u7ec4\u4ef6\u7684\u503c{this.props.number}&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>componentWillReceiveProps(newProps,newContext)<\/strong>\u94a9\u5b50<ul><li>\u5f53\u524d\u63a5\u53d7\u65b0\u7684<strong>props<\/strong>\u65f6,\u4f1a\u89e6\u53d1\u6b21\u65b9\u6cd5<strong>(\u65b0\u7248react\u4e2d\u5df2\u7ecf\u5f03\u7528)<\/strong><\/li><li>\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570,\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u53d8\u5316\u540e\u7684<strong>props<\/strong>\u7684\u503c<\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;class Child exentds Reach.Component{<br> &nbsp; &nbsp; &nbsp; &nbsp;UNSAFE_componentWillReceiveProps(newProps,newContext)<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(props){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(props)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;\u5b50\u7ec4\u4ef6\u7684\u503c{this.props.number}&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u7c7b\u7ec4\u4ef6\u4e2dstate\u7684\u4f7f\u7528(state\u5185\u90e8\u6570\u636e)<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u521d\u59cb\u5316<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;class Child exentds Reach.Component{<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(props){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(props)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.state = {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;userInfo:{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;name:\"\u674e\u96f7\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;age:'18'<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;\u59d3\u540d: {this.state.userInfo.name}&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>\u200b<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>setState<\/strong>\u7684\u6267\u884c\u65f6\u673a\u548c\u63a8\u8350\u5199\u6cd5<ul><li><strong>this.setState(newState,fn)<\/strong> \u63a5\u53d7\u4e24\u4e2a\u53c2\u6570,\u7b2c\u4e00\u4e2a\u53c2\u6570\u63a5\u53d7\u88ab\u4fee\u6539\u7684\u5bf9\u8c61,\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u4fee\u6539\u6210\u529f\u7684\u56de\u8c03<\/li><li><strong>setState<\/strong>\u4f1a\u81ea\u52a8\u5c06<strong>state<\/strong>\u4e0e\u65e7state\u8fdb\u884c\u4e00\u7ea7\u5408\u5e76 ==\u6ce8\u610f:setState\u4e0d\u4f1a\u7acb\u523b\u6539\u53d8<strong>this.state<\/strong>,\u4f1a\u5728\u5f53\u524d\u4ee3\u7801\u8fd0\u884c\u540e,\u5728\u53bb\u66f4\u65b0<strong>this.state<\/strong>,\u4ece\u800c\u89e6\u53d1UI\u66f4\u65b0== \u63a8\u8350\u5199\u6cd5<\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;class Child exentds Reach.Component{<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(props){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(props)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.state = {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;userInfo:{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;name:\"\u674e\u96f7\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;age:'18'<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;test= ()=&gt;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.setState((state)=&gt;({state.userInfo.name = \"\u97e9\u6885\u6885\"}))<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u59d3\u540d: {this.state.userInfo.name}<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;button onClick={this.test}&gt;test&lt;\/button&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>\u200b<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. reatc\u7684\u751f\u547d\u5468\u671f<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>constructor<\/strong><ul><li>\u7528\u9014: \u521d\u59cb\u5316<strong>state<\/strong>,\u6b64\u65f6\u4e0d\u80fd\u8c03\u7528<strong>setState<\/strong><\/li><\/ul><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>render<\/strong><ul><li>\u6267\u884c\u65f6\u673a\uff1a 1. <strong>setState()<\/strong> 2. <strong>forceUpdate()<\/strong> (\u5f3a\u5236\u66f4\u65b0) 3. \u7ec4\u4ef6\u63a5\u6536\u65b0\u7684 <strong>props<\/strong><\/li><li>return\u9700\u8981\u5728\u6700\u5916\u5c42\u5305\u4e00\u5c42\u5757\u7ea7\u5143\u7d20<ul><li>&lt;&gt;&lt;\/&gt;===&lt;React.Fragment&gt;&lt;\/React.Fragment&gt;===&lt;div&gt;&lt;\/div&gt;<\/li><\/ul><\/li><li>\u6280\u5de7<ul><li>\u53ef\u4ee5\u5199<strong>if&#8230;else<\/strong><\/li><li>\u53ef\u4ee5\u5199<strong>\u4e09\u76ee\u8fd0\u7b97<\/strong><\/li><li>\u53ef\u4ee5\u5199<strong>for<\/strong>\u5faa\u73af<\/li><li>\u53ef\u4ee5\u5199<strong>array.map<\/strong><\/li><\/ul><\/li><\/ul><\/li><li><strong>shouldComponentUpdate<\/strong><ul><li>\u7528\u9014: \u8fd4\u56de\u4e00\u4e2abool\u503c,\u8868\u793a\u662f\u5426\u963b\u6b62UI\u66f4\u65b0(\u8fd4\u56detrue\u8868\u793a\u4e0d\u963b\u6b62\u66f4\u65b0)<\/li><li><strong>shouldComponentUpdate(newProps,newState)<\/strong>,\u5305\u542b\u4e24\u4e2a\u53c2\u6570\u5206\u522b\u662f\u65b0\u7684<strong>props<\/strong>\u548c<strong>state<\/strong>\u7684\u503c<\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp; &nbsp;class App extends React.Component {<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(porps){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(porps)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.state &nbsp;={<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;num:0<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  };<br> &nbsp; &nbsp; &nbsp; &nbsp;add = ()=&gt;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.state((state)=&gt;({state.num:num+1}))<br> &nbsp; &nbsp; &nbsp;  },<br> &nbsp; &nbsp; &nbsp; &nbsp;shouldComponentUpdate(newProps,newState){ <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u751f\u547d\u5468\u671f\u51fd\u6570,\u7528\u4e8e\u76d1\u542cstate\u548cprops\u7684\u503c\u662f\u5426\u53d8\u5316,\u8fd4\u56defalse\u548ctrue\u51b3\u5b9a\u662f\u5426\u6e32\u67d3\u89c6\u56fe<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return !(newState.n === this.state.n)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;APP<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;P&gt;{this.state.num}&lt;\/p&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;button onClick={this.add}&gt;add&lt;\/button&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>react\u5185\u7f6e\u4e86\u6b64\u65b9\u6cd5 \u4f7f\u7528\uff1a<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp; &nbsp;class app extends React.PureComponent {}<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>componentDidMount<\/strong><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5143\u7d20\u5df2\u7ecf\u6302\u8f7d<\/li><li>\u53ef\u4ee5\u53d1\u8d77<strong>AJAX<\/strong>\u8bf7\u6c42(\u5b98\u65b9\u63a8\u8350)<\/li><li>\u9996\u6b21\u6e32\u67d3\u4f1a\u6267\u884c\u94a9\u5b50<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code> &nbsp;class App extends React.Component {<br> &nbsp; &nbsp; &nbsp; &nbsp;constructor(porps){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(porps)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u5185\u90e8\u5c5e\u6027\u547d\u540ddom\u5143\u7d20id<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.divRef = React.createRef()<br> &nbsp; &nbsp; &nbsp;  };<br> &nbsp; &nbsp; &nbsp; &nbsp;componentDidMount(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const div = this.divRef.current;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(div)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp;render(){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;div ref={this.divRef}&gt;hello world&lt;\/div&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>componentDidUpdate<\/strong><ul><li>\u7528\u9014 \u89c6\u56fe\u66f4\u65b0\u540e\u6267\u884c\u4ee3\u7801<\/li><li>\u6b64\u5904\u53ef\u4ee5\u4f7f\u7528<strong>AJAx<\/strong>\u8bf7\u6c42\u66f4\u65b0\u6570\u636e<\/li><li>\u9996\u6b21\u4e0d\u4f1a\u6267\u884c\u94a9\u5b50<\/li><li>\u5728\u6b64\u5904setState\u53ef\u80fd\u4f1a\u5f15\u8d77\u65e0\u9650\u5faa\u73af<\/li><li>\u5982\u679c<strong>shouldComponentUpdate<\/strong>\u8fd4\u56de<strong>false<\/strong>,\u5219\u4e0d\u4f1a\u89e6\u53d1<\/li><\/ul><\/li><li><strong>componentWillUnmoun<\/strong><ul><li>\u7528\u9014 \u7ec4\u4ef6\u5c06\u8981\u79fb\u9664\u9875\u9762\u7136\u540e\u88ab\u9500\u6bc1\u65f6\u6267\u884c\u4ee3\u7801<\/li><li><strong>unmount<\/strong>\u8fc7\u7684\u7ec4\u4ef6\u4e0d\u4f1a\u518d\u6b21\u6302\u8f7d<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>class\u7ec4\u4ef6\u7684\u521b\u5efa\u65b9\u5f0f \u7c7b\u7ec4\u4ef6\u4e2dprops\u7684\u4f7f\u7528 \u7c7b\u7ec4\u4ef6\u4e2dstate\u7684\u4f7f\u7528 \u7c7b\u7ec4\u4ef6\u7684\u751f\u547d\u5468\u671f 1. clas [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-react"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=211"}],"version-history":[{"count":0,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}