To goal of this exercise is to create a React website (with create-react-app
) similar to this:
For this exercise, we will create 6 components:
App
Navbar
SectionStudents
Flag
with a propscountry
SectionTopicsToRecap
PostIt
with a propscolor
and a propschildren
To generate a React application, you need to type:
npx create-react-app the-name-of-my-application
To get the picture of a flag, you can rely on these links:
- France: https://www.countryflags.io/fr/flat/64.png
- Germany: https://www.countryflags.io/de/flat/64.png
- Etc.
One way to loop through an array in JavaScript is to do:
<ul>
{myArray.map((element,i) => <li key={i}>
My element {i} is: {JSON.stringify(element)}
</li>)}
</ul>
To do inline styling, you have to give an attribute style
where the value is an object.
Example:
<span style={{color: gender === "male" ? "blue" : "red"}}>...</span>