class App extends React.Component {
state = {
showUser: false
}
render() {
return (
<div>
{this.state.showUser && <User name="Brad" />}
<button onClick={() => this.setState({ showUser: true })}>
Show User
</button>
<button onClick={() => this.setState({ showUser: false })}>
Hide User
</button>
</div>
)
}
}
ReactDOM.render(<App />, document.getElementById('root'))