1import React, {Component} from 'react'
2import ReactDOM from 'react-dom'
3
1render () {
2 this.state.username
3 const { username } = this.state
4 ···
5}
6
7
8
1import React, {
2 Component,
3 Fragment
4} from 'react'
5
6class Info extends Component {
7 render () {
8 const { avatar, username } = this.props
9
10 return (
11 <Fragment>
12 <UserAvatar src={avatar} />
13 <UserProfile username={username} />
14 </Fragment>
15 )
16 }
17}
18
1constructor(props) {
2 super(props)
3 this.state = { username: undefined }
4}
5