forked from kentcdodds/beginners-guide-to-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07-prop-types.html
26 lines (23 loc) · 834 Bytes
/
07-prop-types.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
<body>
<div id="root"></div>
<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/@babel/[email protected]/babel.js"></script>
<script src="https://unpkg.com/[email protected]/prop-types.js"></script>
<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>