-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
51 lines (44 loc) · 833 Bytes
/
index.js
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
/*eslint-disable*/
import { createElement, Component, useState } from './cute-react';
import { render } from './cute-react-dom';
function Header() {
return (
<div id="a" class="bbb">
<div>header</div>
<div></div>
<div></div>
</div>
);
}
class Body extends Component {
render() {
return (
<div id="c" class="ddd">
<div>body</div>
</div>
);
}
}
function App(props) {
const [num, setNum] = useState(10);
const handleNumber = () => {
console.log('increase num');
setNum((c) => c + 1);
};
return (
<div id="a" class="bbb">
<Header />
<Body />
<h1 onClick={handleNumber}>{num}</h1>
{props.children}
</div>
);
}
render(
<App>
<div>First</div>
<div>Second</div>
<div>Third</div>
</App>,
document.body
);