Using JavaScript, write a function that accepts two numbers and returns them multiplied together.
Using
.map()
and.forEach()
, add the necessary JavaScript to print out each of the words with an!
appended to the end, such as:
One!
Two!
Three!
Four!
Five!
const words = [{
content: "One",
},{
content: "Two",
},{
content: "Three",
},{
content: "Four",
},{
content: "Five"
}]
Write the code to create a component named
HelloWorld
. It should have the template<p>Hello, world!</p>
!
Write the code to create a component named
DisplayMessage
. It should accept a prop calledmessage
and display it in<p></p>
tags.
Write the code to import a React component named
Avatar
using ESM syntax. Export a React component namedUserCard
that has a single prop calleduser
. Use theAvatar
component as the template for theUserCard
component, passuser.avatarUrl
into a prop namedurl
.
Write the code to export a React component named
StopAndGo
that takes a boolean prop calledactive
. Ifactive
is true, the component should display<span>Go!</span>
, otherwise it should display<span>Stop!</span>
.
Write the code to import a React component named
ListItem
using ESM syntax. Export a React component namedUnorderedList
that accepts an array calleditems
as a prop. In the template, iterate through theitems
array and create a new instance ofListItem
for each item, passing the item into thecontent
prop forListItem
.
Write the code to export a React component called
LoginForm
. It should have 2 labeled inputs forusername
andpassword
, both of which should be logged to the console when the form is submitted.
Using the API endpoint https://pokeapi.co/api/v2/pokemon/pikachu, write the code to create a component that fetches a Pikachu object and displays a sprite (eg.
pikachu.sprites.front_default
) in an<img />
.
Change this code to use context instead of props:
function Outer(){
return <Inner prop="prop" />
}
function Inner({prop}){
return <p>{prop}</p>
}
What is a hook?