Created
July 15, 2016 19:23
-
-
Save StillLearnin/893a96587ef7c11ed72faceb01077096 to your computer and use it in GitHub Desktop.
React Component as ES6 class with state.
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 bindAll from 'lodash/bindAll'; | |
class Report extends React.Component { | |
constructor() { | |
super(); | |
this.state = {}; | |
bindAll(this, 'click'); | |
} | |
render() { | |
if (!this.state.open) | |
return null; | |
return <div> | |
{this.props.children} | |
</div> | |
} | |
click() { | |
alert('Ha!') | |
} | |
} | |
export default Report; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment