diff --git a/B/P06.html b/B/P06.html index 7f36654c9..aeea3a954 100644 --- a/B/P06.html +++ b/B/P06.html @@ -1,7 +1,7 @@ @@ -26,15 +26,19 @@ } render(){ const {ishot}=this.state; - return

今天天气很{ishot ? '炎热' : '凉爽'}

+ // 解决this指向问题 + return

今天天气很{ishot ? '炎热' : '凉爽'}

+ } + demo(){ + this.setState({ + ishot:!this.state.ishot + }) } } ReactDOM.render( ,document.getElementById('app') ) - function demo(){ - console.log('xxx') - } + \ No newline at end of file diff --git a/B/P07.html b/B/P07.html new file mode 100644 index 000000000..6cd91f408 --- /dev/null +++ b/B/P07.html @@ -0,0 +1,38 @@ + + + + + + + state + + +
+ + + + + + \ No newline at end of file