Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tours.js #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 15 additions & 5 deletions 02-tours/final/src/Tours.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import React from 'react';
import Tour from './Tour';
import React from 'react'; // Importing React library
import Tour from './Tour'; // Importing the Tour component

// Tours component receives a list of tours and a function to remove a tour as props
const Tours = ({ tours, removeTour }) => {
return (
<section>
{/* Section header */}
<div className="title">
<h2>our tours</h2>
<div className="underline"></div>
<div className="underline"></div> {/* Decorative underline */}
</div>
<div>
{/* Iterating through the tours array and rendering a Tour component for each tour */}
{tours.map((tour) => {
return <Tour key={tour.id} {...tour} removeTour={removeTour} />;
return (
<Tour
key={tour.id} // Unique key for each tour
{...tour} // Spread operator to pass all tour properties as props
removeTour={removeTour} // Passing the removeTour function as a prop
/>
);
})}
</div>
</section>
);
};

export default Tours;
export default Tours; // Exporting the Tours component