Created
September 5, 2018 07:15
-
-
Save codingnninja/1bde243523a75cfa4ae98fccfd952edc 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
'use strict'; | |
const e = React.createElement; | |
class FollowButton extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { follow: false }; | |
} | |
render() { | |
if (this.state.follow) { | |
return 'You are following this.'; | |
} | |
//create like button | |
return e( | |
'button', | |
{ onClick: () => this.setState({ follow: true }) }, | |
'Follow' | |
); | |
} | |
} | |
//get DOM entry point with an Id called root | |
const domEntryPoint= document.getElementById('root'); | |
ReactDOM.render(e(FollowButton), domEntryPoint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment