Created
July 28, 2018 15:19
-
-
Save dwyfrequency/0fc41ee6442477e9373c6d4c19a471c1 to your computer and use it in GitHub Desktop.
firstReactJSCompontent
This file contains 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> | |
<div class="person"> | |
<h1>Tom</h1> | |
<h1>Your age: 28</h1> | |
</div> |
This file contains 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> | |
<h1>Your age: {props.age}</h1> | |
</div> | |
); | |
} | |
const app = ( | |
<div> | |
<Person name="Bilbo" age="24"/> | |
<Person name="Baggins" age="28"/> | |
</div> | |
) | |
ReactDOM.render(app, document.querySelector('#app')); | |
// ReactDOM.render(<Person name="Bilbo" age="24"/>, document.querySelector('#p1')); | |
// ReactDOM.render(<Person name="Baggins" age="24"/>, document.querySelector('#p2')); |
This file contains 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/16.4.1/umd/react.production.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.1/umd/react-dom.production.min.js"></script> |
This file contains 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
/* * { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} */ | |
.person { | |
display: inline-block; | |
border: 1px solid #eee; | |
/* x | y | blur radius | color */ | |
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