add initialization of state to States

This commit is contained in:
Benjamin Atkin 2017-12-07 13:35:08 -08:00 committed by GitHub
parent 0c6c42626a
commit d7ab72a10c
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' })
``` ```