forked from kentcdodds/beginners-guide-to-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07-prop-types.html
More file actions
26 lines (23 loc) · 834 Bytes
/
07-prop-types.html
File metadata and controls
26 lines (23 loc) · 834 Bytes
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
<body>
<div id="root"></div>
<script type="text/babel">
const rootElement = document.getElementById('root')
function SayHello({firstName, lastName}) {
return (
<div>
Hello {firstName} {lastName}!
</div>
)
}
SayHello.propTypes = {
firstName: PropTypes.string.isRequired,
lastName: PropTypes.string.isRequired,
}
const element = <SayHello firstName={false} />
ReactDOM.render(element, rootElement)
</script>
</body>