Skip to content

Instantly share code, notes, and snippets.

@wuz
Created December 30, 2020 20:04
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 wuz/914d3d963084e0356632198da485499e to your computer and use it in GitHub Desktop.
Save wuz/914d3d963084e0356632198da485499e to your computer and use it in GitHub Desktop.
Remote Test
'use strict';
const e = React.createElement;
class LikeButton extends React.Component {
constructor(props) {
super(props);
this.state = { liked: false };
}
render() {
if (this.state.liked) {
return 'You liked this.';
}
return e(
'button',
{ onClick: () => this.setState({ liked: true }) },
'Like'
);
}
}
const domContainer = document.querySelector('#like_button_container');
ReactDOM.render(e(LikeButton), domContainer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment