Состояние функции React Cheatsheet
import React, {Component} from 'react'
import ReactDOM from 'react-dom'
Ugliest Unicorn
import React, {Component} from 'react'
import ReactDOM from 'react-dom'
constructor(props) {
super(props)
this.state = { username: undefined }
}
this.forceUpdate()
const el = document.body
ReactDOM.render(<Hello name='John' />, el)
class Hello extends Component {
...
}
render () {
this.state.username
const { username } = this.state
···
}