Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,42 @@ https://reactjs.org/docs/lists-and-keys.html
Feel free to create more components, such as header/footer,
or why not include some more data from the array? */


import React from 'react';
import data from './data.json'; // Ensure the path is correct

//Pokemon component to display the name of each Pokémon
const Pokemon = ({ name, height, id }) => {
return (
<div className="pokemon">
<h2>{name}</h2>
<p><strong>Height:</strong> {height}</p>
<p><strong>Id:</strong> {id}</p>
</div>
);
};

// Header component
const Header = () => <h1>Pokémon List</h1>;

// Footer component
const Footer = () => <footer>© 2024 Pokémon Inc.</footer>;

// Main App component
export const App = () => {
return (
<div className="App">
<p>Pokemon goes here</p>
<Header />
{data.pokemons.map((pokemon) => (
<Pokemon
key={pokemon.id}
name={pokemon.name}
height={pokemon.height}
id={pokemon.id}
/>
))}
<Footer />
</div>
);
};

13 changes: 13 additions & 0 deletions src/components/Pokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@
export const Pokemon = () => {
return <div>Pokemon</div>;
};



const Pokemon = ({ name, types }) => {
return (
<div className="pokemon">
<h2>{name}</h2>
<p>Types: {types.join(', ')}</p>
</div>
);
};