-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (46 loc) · 1.55 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 lang="en">
<body>
<div id="root"></div>
</body>
<script src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/[email protected]/prop-types.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel">
function Btn({text, fontSize = 13}){
return (
<button
style={{
backgroundColor :"tomato",
color : "white",
padding:"10px 20px",
border :"0",
borderRadius:10,
fontSize,
}}>
{text}
</button>
);
}
/*
props를 받을 때 type 실수를 할
*/
Btn.propTypes = {
text : PropTypes.string,
fontSize : PropTypes.number,
};
function App() {
const [value, setValue] = React.useState("Save State");
const changeValue = () => setValue("Changed text");
return (
<div>
<Btn text="Confirm" fontSize = {18} />
<Btn text= "Click" />
</div>
);
}
const root = document.getElementById("root");
ReactDOM.render(<App/>, root);
</script>
</html>