-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
// The following line makes sure your styles are included in the project. Don't remove this. | ||
import "../styles/main.scss"; | ||
import "regenerator-runtime/runtime"; | ||
import React from "react"; | ||
import ReactDom from "react-dom"; | ||
import Faker from "faker"; | ||
// Import any additional modules you want to include below \/ | ||
|
||
// \/ All of your javascript should go here \/ | ||
|
||
//Counter and empty array | ||
let listCount = 4; | ||
let listItems = []; | ||
|
||
//Loop how many list items you want to create | ||
while (listCount) { | ||
//Create Random information with Faker | ||
let randomName = Faker.name.findName(); | ||
let randomEmail = Faker.internet.email(); | ||
let randomPhone = Faker.phone.phoneNumber(); | ||
//Create a list elelement on every iteration | ||
let listItem = React.createElement("li", {}, randomName, React.createElement("a", {}, randomPhone), React.createElement("a", {}, randomEmail)); | ||
listItems.push(listItem); | ||
listCount--; | ||
} | ||
|
||
//Create ul element add a header and span inside, and finally listItems array | ||
let listContainer = React.createElement("ul", {}, React.createElement("h1", {}, "My ", React.createElement("span", { className: "highLight" }, "awesome "), "contacts list"), listItems); | ||
|
||
//append the Ul element inside the container | ||
ReactDom.render(listContainer, document.querySelector(".container")); |