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

render list items on List component #15

Merged
merged 1 commit into from
Apr 7, 2023
Merged

Conversation

Amy-Pr
Copy link
Collaborator

@Amy-Pr Amy-Pr commented Apr 4, 2023

Description

This code renders data fetched from the backend on the List component. We created a map function to map over each element in the data array and create a ListItem component to display for each element.

Learning: We reviewed how to use Chrome React tools to look at the shape of the props being passed.

Related Issue

closes #1

Acceptance Criteria

  • The streamListItems function is used in App.jsx to get the items in the current list from the Firestore database
  • The list is passed into the List component as a prop named data.
  • In List.jsx, the ListItem component is used to render the name of each item

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
💯 Add tests
🔗 Update dependencies
📜 Docs

Updates

Before

Screen Shot 2023-04-04 at 3 03 53 PM

After

Capture-after-2

Testing Steps / QA Criteria

  • Open the Smart Shopping List app
  • Direct browser to the list page by adding /list to the url

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Visit the preview URL for this PR (updated for commit e203c48):

https://tcl-57-smart-shopping-list--pr15-ap-jg-render-list-it-hvlk1cdc.web.app

(expires Tue, 11 Apr 2023 22:09:16 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: ad3eb6c34c2ec5986fcc218178df5985eb9c9ffb

Copy link
Collaborator

@emilysellers emilysellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. The map function is successfully rendering each list item name.

Copy link
Contributor

@bethmelmtv bethmelmtv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the links. No issues with the code. Great work!

Copy link
Collaborator

@danainjax danainjax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @Amy-Pr and @jongranados. Looks very clean.

Comment on lines +16 to +17
data.map((item) => (
<ListItem name={item.name} key={item.id} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! You can also choose to destructure the item object to pass the attributes without dot notation, if you wish.

{data.map(({ name, id }) => ( <ListItem key={id} name={name} /> ))}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1. As a user, I want to read the names of all of the items in my shopping list
4 participants