mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-15 18:08:46 +00:00
30 lines
609 B
JavaScript
30 lines
609 B
JavaScript
'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); |