From 40df3cc91e2e975bc28dc4b1641286685bb1bf0a Mon Sep 17 00:00:00 2001 From: CosSalt Date: Sat, 13 Oct 2018 23:53:54 +0800 Subject: [PATCH] =?UTF-8?q?setState=E6=97=B6state=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=80=BC=E6=9C=AA=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this.state.count 应该还是undefined而非NaN --- _posts/2017-02-21-lesson10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2017-02-21-lesson10.md b/_posts/2017-02-21-lesson10.md index b643df8..5a64fde 100644 --- a/_posts/2017-02-21-lesson10.md +++ b/_posts/2017-02-21-lesson10.md @@ -125,7 +125,7 @@ ReactDOM.render( handleClickOnLikeButton () { this.setState({ count: 0 }) // => this.state.count 还是 undefined this.setState({ count: this.state.count + 1}) // => undefined + 1 = NaN - this.setState({ count: this.state.count + 2}) // => NaN + 2 = NaN + this.setState({ count: this.state.count + 2}) // => undefined + 2 = NaN } ... ```