You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1008 B
38 lines
1008 B
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title></title>
|
|
<link rel="stylesheet" href="lib/antd/antd.css" />
|
|
</head>
|
|
<body>
|
|
<div id="like_button_container"></div>
|
|
<script src="lib/react/umd/react.development.js"></script>
|
|
<script src="lib/react-dom/umd/react-dom.development.js"></script>
|
|
<script src="lib/antd/antd.js"></script>
|
|
<script src="lib/babel-standalone/babel.js"></script>
|
|
<script type="text/babel">
|
|
class LikeButton extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = { liked: false };
|
|
}
|
|
|
|
render() {
|
|
if (this.state.liked) {
|
|
return 'You liked this.';
|
|
}
|
|
|
|
return (
|
|
<button onClick={() =>
|
|
this.setState({ liked: true })}>
|
|
Like
|
|
</button>
|
|
);
|
|
}
|
|
}
|
|
|
|
ReactDOM.render(React.createElement(LikeButton), document.querySelector('#like_button_container'));
|
|
</script>
|
|
</body>
|
|
</html> |