Skip to content

Instantly share code, notes, and snippets.

@codingnninja
Created September 5, 2018 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingnninja/83ca2b2456e16463c1b1672aaad48702 to your computer and use it in GitHub Desktop.
Save codingnninja/83ca2b2456e16463c1b1672aaad48702 to your computer and use it in GitHub Desktop.
const e = React.createElement;
class FollowButton extends React.Component {
constructor(props) {
super(pros);
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'
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment