-
Notifications
You must be signed in to change notification settings - Fork 0
/
react04.html
30 lines (28 loc) · 987 Bytes
/
react04.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
<!-- Let’s recap what happens in this example:
1 We call ReactDOM.render() with the <Welcome name="Sara" /> element.
2 React calls the Welcome component with {name: 'Sara'} as the props.
3 Our Welcome component returns a <h1>Hello, Sara</h1> element as the result.
4 React DOM efficiently updates the DOM to match <h1>Hello, Sara</h1>. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</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>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
const element = <Welcome name="Sara" />;
ReactDOM.render(
element,
document.getElementById('root')
);
</script>
</body>
</html>