A Pen by Akinseye Olawale on CodePen.
Created
January 18, 2018 15:51
-
-
Save brainyfarm/6f240475894de3e96a1bbb531264ed99 to your computer and use it in GitHub Desktop.
React First Code
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
<div id="app"></div> |
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
function Person(props) { | |
return ( | |
<div className="person"> | |
<h1> { props.name } </h1> | |
<p> Your age is { props.age }</p> | |
</div> | |
) | |
} | |
var Persons = ( | |
<div> | |
<Person name="Max" age="28" /> | |
<Person name="Maddy" age="32" /> | |
</div> | |
) | |
ReactDOM.render(Persons, app); | |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js"></script> |
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
.person { | |
display: inline-block; | |
margin: 10px; | |
border: 1px solid #eee; | |
box-shadow: 0 2px 2px #ccc; | |
width: 200px; | |
padding: 20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment