Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KTruong008/0aac67c898b2e00c20e5b510506a3b77 to your computer and use it in GitHub Desktop.
Save KTruong008/0aac67c898b2e00c20e5b510506a3b77 to your computer and use it in GitHub Desktop.
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