![Screenshot 2025-02-09 at 01 33 36](https://private-user-images.githubusercontent.com/16071502/411263725-98614497-6519-4a6e-adea-d18e95c81052.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0ODc3OTIsIm5iZiI6MTczOTQ4NzQ5MiwicGF0aCI6Ii8xNjA3MTUwMi80MTEyNjM3MjUtOTg2MTQ0OTctNjUxOS00YTZlLWFkZWEtZDE4ZTk1YzgxMDUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDIyNTgxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBkNDcxYjIyNTg3M2RlMmU0YzhlZjhhM2M3YTUzYmZmNGIwMjExOTRiYmVjZTlmYzc1YmM0NWFmYjAxMTlkNDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.-36luLXw_hveqCRKLortWmsrOWr9_2yrbP6Asb64uPw)
Birthday Buddy is a simple React application that displays a list of people with their birthdays. Users can view the list of people and clear the list with a button click.
** Online Live:** https://birthday-buddy-arnob.netlify.app/
- Clone the repository.
- Navigate to the project directory.
- Install the dependencies:
npm install
To start the development server, run:
npm run dev
The main component that sets up the state and renders the list of people. It also includes a button to clear the list.
A component that receives the list of people as props and maps over them to render each person using the Person
component.
A component that receives individual person data as props and renders the person's image, name, and age.
The project uses a global CSS file (src/index.css
) to style the components. The CSS includes variables for colors, fonts, and other design elements.
The data is imported from data.js, which contains an array of objects representing people with their id
, name
, age
, and image
URL.
- Display List: The list of people is displayed with their images, names, and ages.
- Clear List: A button allows users to clear the list of people.
In App.jsx, import the data (from data.js) to be rendered as an array of objects. Each object should represent a person and contain properties such as name, age, and image URL.
Then, set up the data as a state variable using the useState hook. This will allow the data to be modified and have those changes automatically reflected in the rendered output.
Display the number of items in the list by using the length property of the state variable. This information can be displayed using plain text or added to a message or heading element.
To render the list of people, iterate over the data array using the map method. For each item in the array, render an image element (hint : use inline styles to make width smaller).Additionally, render the person's name and age as plain text.
Create a List component to hold the rendered items. This component can be a simple div element containing the list of Person components.
Create a Person component to render the information for each person. This component should receive the person data as props and render the image, name, and age information.
In App.jsx, add a button to clear the list, and set up the functionality by defining a function that resets the state variable to an empty array.
Overall, the flow of the application should look something like this:
- Import the data you want to render in App.jsx.
- Set up the data as a state variable using useState.
- Use the map method to iterate over the data array and render a Person component for each person.
- Each Person component should render an image with a style prop to control the width, the person's name, and the person's age.
- Create a List component that holds the rendered items.
- Create a button with functionality to clear the list.
- Display the number of items in the list using the length property of the state variable. This can be rendered using plain text or added to a message or heading element.