Merge pull request #316 from benjamin-atkin/patch-1

add initialization of state to States
This commit is contained in:
Rico Sta. Cruz 2017-12-10 19:48:06 +08:00 committed by GitHub
commit 97a5b71ef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -69,6 +69,13 @@ See: [Properties](https://reactjs.org/docs/tutorial.html#using-props)
### States ### States
```jsx
constructor(props) {
super(props)
this.state = {}
}
```
```jsx ```jsx
this.setState({ username: 'rstacruz' }) this.setState({ username: 'rstacruz' })
``` ```