Skip to content

Commit 424b643

Browse files
authored
Create solution.hide.jsx
1 parent 1579f06 commit 424b643

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
const planets = ["Mars", "Venus", "Jupiter", "Earth", "Saturn", "Neptune"];
5+
6+
/**
7+
* 1) Create the mapping function and use it to generate a new array of
8+
* planets in html called planetsInHTML
9+
*/
10+
const planetsInHTML = planets.map((planet, index) => {
11+
return (
12+
<li key={index} className="list-group-item">
13+
{planet}
14+
</li>
15+
);
16+
});
17+
18+
// 2) Add the array planetsInHTML inside the innerHTML of this <ul>
19+
const content = <ul className="list-group m-5">{planetsInHTML}</ul>;
20+
21+
ReactDOM.render(content, document.querySelector("#myDiv"));

0 commit comments

Comments
 (0)