-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcounter.html
33 lines (27 loc) · 974 Bytes
/
counter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://unpkg.com/react@17/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<title>Counter</title>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
function App() {
const [count, setCount] = React.useState(0);
function updateCount() {
setCount(count + 1);
}
return (
<div>
<h1>{count}</h1>
<button onClick={updateCount}>Count</button>
</div>
);
}
ReactDOM.render(<App />, document.querySelector("#app"));
</script>
</body>
</html>