-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
59 lines (51 loc) · 1.38 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
<script src="react.development.web.js"></script>
<script src="react-dom.development.web.js"></script>
<!-- Don't use this in production: -->
<!-- <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> -->
<script src="babel.min.js"></script>
</head>
<body>
<!-- We will put our React component inside this div. -->
<div id="root"></div>
<!-- Load our React component. -->
<script type="text/babel">
class App extends React.Component {
innerClick = e => {
debugger;
console.log("A: react inner click.");
// e.stopPropagation();
};
outerClick = () => {
console.log("B: react outer click.");
};
componentDidMount() {
document
.getElementById("outer")
.addEventListener("click", () => console.log("C: native outer click"));
window.addEventListener("click", () =>
console.log("D: native window click")
);
}
render() {
return (
<div id="outer" onClick={this.outerClick}>
<button id="inner" onClick={this.innerClick}>
BUTTON
</button>
</div>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
</script>
<!-- <script src="like_button.js"></script> -->
</body>
</html>