Created
January 30, 2018 22:06
-
-
Save aerrity/4747b644e781cf254340a93deb9841bd to your computer and use it in GitHub Desktop.
React props example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| function NameLength(props) { | |
| return <h1>The name {props.name} contains {props.name.length} characters!</h1>; | |
| } | |
| function App() { | |
| return ( | |
| <div> | |
| <NameLength name="Johnny" /> | |
| <NameLength name="Gillian" /> | |
| <NameLength name="Jordan" /> | |
| </div> | |
| ); | |
| } | |
| ReactDOM.render( | |
| <App />, | |
| document.getElementById('root') | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment