Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement