Tell us what’s happening:
I put this code but it doesn’t work. I think it’s ok.
Your code so far
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
display: true
}
this.toggleDisplay = this.toggleDisplay.bind(this);
}
toggleDisplay() {
this.setState({
display: !this.state.display
});
}
render() {
// change code below this line
return
(
<div>
<button onClick={this.toggleDisplay}>
Toggle Display
</button>
{ this.state.display && <h1>Displayed!</h1> }
</div>
);
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge: