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
satDataassatData. - Pass the props created from the
App()function:filterByType,setSat, anddisplaySats. - Update the first button:
This function needs to return a
<div>that used themapfunction to iterate over thedisplaySatsvariable.- Provide two callbacks for the
mapfunction:idandsat. - The
mapfunction will return the first<button>. - Inside the
<button>tag create the following:- An
onClickmethod that points tofilterByType()function. - Set the
keyequal 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
mapfunction. - Inside the
<button>tag, create anonClickfunction that points tosetSat. PasssatDatatosetSat.
- This button needs to be outside of the