class App extends React.Component {
constructor(props) {
super(props)
this.state = { username: 'johndoe' }
}
render() {
const { username } = this.state
return(
<div>
{ username }
</div>
)
}
}
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}
const Welcome ({ name }) => <h1>Hello, {name}</h1>;