Created
June 1, 2017 01:16
-
-
Save KTruong008/0aac67c898b2e00c20e5b510506a3b77 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 from 'react'; | |
import CoolBox from '../CoolBox'; | |
export class Final extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { isCool: false } | |
} | |
toggleCoolness = () => { | |
this.setState({ isCool: !this.state.isCool }) | |
} | |
render() { | |
const { isCool } = this.state; | |
return ( | |
<div> | |
<button onClick={this.toggleCoolness}>Click Me</button> | |
{isCool ? ( | |
<CoolBox /> | |
) : ( | |
<div></div> | |
)} | |
</div> | |
); | |
} | |
} | |
export default Final; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment