Task 4: Update Buttons.jsx
In this step, you will create the following:
- Four clickable buttons
- Three of them will use the props you passed from the
App()
function - One will display all of the satellites
- Three of them will use the props you passed from the
Inside the Buttons.jsx
component:
- Import the
satData
assatData
. - Pass the props created from the
App()
function:filterByType
,setSat
, anddisplaySats
. - Update the first button:
This function needs to return a
<div>
that used themap
function to iterate over thedisplaySats
variable.- Provide two callbacks for the
map
function:id
andsat
. - The
map
function will return the first<button>
. - Inside the
<button>
tag create the following:- An
onClick
method that points tofilterByType()
function. - Set the
key
equal toid
.
- An
- Between the
<button>
tags, replace"Placeholder Button"
with{sat} Orbit
.
7 8 9 10 11 12 13 14
{displaySats.map((sat, id) => { return ( <button onClick={() => filterByType(sat)} key={id}> {sat} Orbit </button> ); })} //code continues
- Provide two callbacks for the
- Update the second button:
- This button needs to be outside of the
map
function. - Inside the
<button>
tag, create anonClick
function that points tosetSat
. PasssatData
tosetSat
.
- This button needs to be outside of the