Skip to content

Commit 5621fc5

Browse files
committed
3.2 exercise
1 parent 742fc09 commit 5621fc5

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed
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"));
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
//create your function here
5+
6+
//remember to use ReactDOM.render to include the component into the website
7+

exercises/03-render-with-functions/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ReactDOM from "react-dom"; //we use ReactDOM to render into the DOM
44

55
// This function returns a string that will be rendered
66
export const PrintHello = () => {
7-
return <h1>Hello World</h1>;
7+
return <h1>I Love React</h1>;
88
};
99

1010
// what where

exercises/03.1-your-first-component/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export const PrintHello = () => {
66
};
77

88
// change the syntax of the first parameter to make it <PrintHello /> instead of PrintHello()
9-
ReactDOM.render(PrintHello(), document.querySelector("#myDiv"));
9+
ReactDOM.render(<PrintHello />, document.querySelector("#myDiv"));

exercises/03.2-a-real-component/app.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import React from "react";
22
import ReactDOM from "react-dom";
33

44
//create your function here
5-
5+
const BootstrapCard = () => {
6+
return (
7+
<div className="card m-5">
8+
<img className="card-img-top" src="../../.learn/assets/Dylan.png?raw=true" alt="Card image cap" />
9+
<div className="card-body">
10+
<h5 className="card-title">Bob Dylan</h5>
11+
<p className="card-text">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.</p>
12+
<a href="https://en.wikipedia.org/wiki/Bob_Dylan" className="btn btn-primary">Go to wikipedia</a>
13+
</div>
14+
</div>
15+
)
16+
}
617
//remember to use ReactDOM.render to include the component into the website
7-
18+
ReactDOM.render(<BootstrapCard />, document.querySelector('#myDiv'));

0 commit comments

Comments
 (0)