Created
September 4, 2016 22:49
-
-
Save choonkending/e87b8c772a4ed47c611dce1da170c441 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class ConcreteToggle extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { isActive: false }; | |
this.onToggle = this.onToggle.bind(this); | |
} | |
render() { | |
return ( | |
<div> | |
<p onClick={this.onToggle}>title</p> | |
{ this.state.isActive && <p>content</p> } | |
</div> | |
); | |
} | |
onToggle() { | |
this.setState({ isActive : !this.state.isActive }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment