-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chapter2_Topic1_Question7.html
48 lines (43 loc) · 1.19 KB
/
Chapter2_Topic1_Question7.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Question 7</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
class Confirm extends React.Component {
render() {
return <div>{message}</div>;
}
}; // single one js file
const confirm = message => React.lazy(() => import('./Confirm')); // not real code
class App extends React.Component {
render() {
return (
<div>
Hello World!
</div>
);
}
async componentDidMount() {
let res = await confirm('Are you sure to delete?');
if (res) {
console.log('Yes');
} else {
console.log('No');
}
}
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
</script>
</body>
</html>