Skip to content

Commit b01a991

Browse files
committed
EjerciciosRealizados
1 parent 308f81b commit b01a991

File tree

40 files changed

+510
-42
lines changed

40 files changed

+510
-42
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react"; // Main React.js library
2+
3+
import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM
4+
5+
// WHAT: This variable contains the html to render
6+
let output = <span>James is 12 years old</span>;
7+
8+
// WHERE: A DOM element that will contain the entire react generated html
9+
const myDiv = document.querySelector("#myDiv");
10+
11+
//what //where
12+
ReactDOM.render(output, myDiv);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
// If we have a variable
5+
let age = "12";
6+
let name = "John";
7+
8+
// We can use it in our html like this
9+
let output = <span>James is {age} years old</span>;
10+
11+
// Use react-dom to render it
12+
ReactDOM.render(output, document.querySelector("#myDiv"));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
const customer = {
5+
first_name: "Bob",
6+
last_name: "Dylan"
7+
};
8+
9+
// Your code inside these <div> tags
10+
const output = <div></div>;
11+
12+
// what where
13+
ReactDOM.render(output, document.querySelector("#myDiv"));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react"; // Main React.js library
2+
import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM
3+
4+
const data = {
5+
image: "../../.learn/assets/Dylan.png?raw=true",
6+
cardTitle: "Bob Dylan",
7+
cardDescription:
8+
"Bob Dylan (born Robert Allen Zimmerman, May 24, 1941) is an American singer-songwriter, author, and artist who has been an influential figure in popular music and culture for more than five decades.",
9+
button: {
10+
url: "https://en.wikipedia.org/wiki/Bob_Dylan",
11+
label: "Go to wikipedia",
12+
},
13+
};
14+
15+
// Modify the 'content' variable below to display the desired bootstrap card
16+
let content = (
17+
<img src={data.image} />
18+
);
19+
20+
ReactDOM.render(content, document.querySelector("#myDiv"));
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react"; // Main React.js library
2+
import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM
3+
4+
// Only update the value of this array
5+
const navlinkItems = [];
6+
7+
const content = <ul className="nav">{navlinkItems}</ul>;
8+
9+
ReactDOM.render(content, document.querySelector("#myDiv"));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
const animals = ["Horse", "Turtle", "Elephant", "Monkey"];
5+
6+
/**
7+
* Change the content inside the map function
8+
**/
9+
const animalsInHTML = animals.map((singleAnimal, index) => {
10+
return <li>hello</li>;
11+
});
12+
13+
ReactDOM.render(<ul>{animalsInHTML}</ul>, document.querySelector("#myDiv"));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
const animals = [{ label: "Horse" }, { label: "Turtle" }, { label: "Elephant" }, { label: "Monkey" }];
5+
6+
/**
7+
* Change the content of the map function
8+
**/
9+
const animalsInHTML = animals.map((singleAnimal, index) => {
10+
return <li>hello</li>;
11+
});
12+
13+
ReactDOM.render(<ul>{animalsInHTML}</ul>, document.querySelector("#myDiv"));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
11+
12+
13+
// 2) Add the array planetsInHTML inside the innerHTML of this <ul>
14+
const content = (<ul className="list-group m-5"></ul>);
15+
16+
ReactDOM.render(content, document.querySelector("#myDiv"));
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react"; // Main React.js library
2+
3+
import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM
4+
5+
// This function returns a string that will be rendered
6+
export const PrintHello = () => {
7+
return <h1>Hello World</h1>;
8+
};
9+
10+
// what where
11+
ReactDOM.render(PrintHello(), document.querySelector("#myDiv"));
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
export const PrintHello = () => {
5+
return <h1>I Love React</h1>;
6+
};
7+
8+
// Change the syntax of the first parameter to make it <PrintHello /> instead of PrintHello()
9+
ReactDOM.render(PrintHello(), document.querySelector("#myDiv"));

0 commit comments

Comments
 (0)