scrimba
React Fundamentals - State & Events
Information Flow
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Information Flow
AboutCommentsNotes
Information Flow
Expand for more info
App.js
run
preview
console
import React, { useState } from "react";
import Header from "./Header";
import PetCard from "./PetCard";
import { pets as petsArray } from "./data"

/*

Component Hierarchy

App
├───Header
└───PetCard

*/

function App() {
const [pets, setPets] = useState(petsArray)

const petCards = pets.map((petObj) => {
return (
<PetCard
key={petObj.id}
name={petObj.name}
image={petObj.image}
favSnacks={petObj.favSnacks}
isAdopted={petObj.isAdopted}
/>
);
});

return (
<div>
<Header />
<main>{petCards}</main>
</div>
);
}

export default App;
Console
null
,
/index.html
-8:12