In this lab, you'll build a simple view using createElement()
.
Before we start, don't forget to add the React
and ReactDOM
libraries to your index.html
:
<script src="node_modules/react/dist/react.js"></script>
<script src="node_modules/react-dom/dist/react-dom.js"></script>
This should be after any page content, and before your own index.js
script.
Your task is to create a React element that represents you (or a close approximation, hopefully)! In the index.js
file create a variable called meInReact
. This variable should be a React element, and should have the following structure:
<div class="me">
<h1>An Awesome Person</h1>
<p>Who is learning React</p>
<ul class="me__interests">
<li>JavaScript</li>
<li>React</li>
<li>Movies</li>
<li>Ice cream</li>
</ul>
</div>
Feel free to render out the component in the DOM using ReactDOM.render()
.