-
Notifications
You must be signed in to change notification settings - Fork 0
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 shopping list items #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job here! Happy to see the app starting to grow 🚀
I left two comments for further improvement. Feel free to address them before merging or reach out if you have any questions.
src/views/Home.jsx
Outdated
* so we can see which lists the user has access to. | ||
*/} | ||
{data.map((list, id) => ( | ||
<SingleList key={id} name={list.name} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SingleList
component also receives path and setListPath
as props. We should pass these props to ensure the list path is correctly stored and can be used to retrieve the list data.
Apart from that, this is very nice code. It's great that you added the key
✨
src/App.jsx
Outdated
@@ -38,7 +38,7 @@ export function App() { | |||
* This custom hook takes our token and fetches the data for our list. | |||
* Check ./api/firestore.js for its implementation. | |||
*/ | |||
const data = useShoppingListData(listPath); | |||
const data = useShoppingListData('/A45I0SLfsWeHLDg47ETZM5vP8fG2/test-list'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once SingleList
receives all the props, we should be able to remove the hardcoded list path and replace it with listPath
again.
Visit the preview URL for this PR (updated for commit 71e332c): https://tcl-78-smart-shopping-list--pr16-el-tc-display-list-i-l8rjvk3u.web.app (expires Mon, 26 Aug 2024 07:45:48 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c781903507c1507075d7a974036959ddeec29c0a |
For an example of how to fill this template out, see this Pull Request.
Description
SingleList and ListItem components imported into Home and List pages and implemented to render shopping lists and shopping list's items on those pages.
Related Issue
closes #2
Acceptance Criteria
useShoppingLists
hook is used inApp.jsx
to get the shopping lists a user has access to from the databaseHome
component as a prop nameddata
setListPath
function is passed into theHome
component so we can update the current listuseShoppingListData
hook is used inApp.jsx
to get the items in the current list from the Firestore databaseList
component as a prop nameddata
Home.jsx
, theSingleList
component is used to render the name of each shopping list a user is subscribed toList.jsx
, theListItem
component is used to render the name of each itemType of Changes
enhancement
Updates
Before
After
Testing Steps / QA Criteria
npm start
Navigate to the browser
Check Homepage to see the rendered shopping
Check the List page to see the rendered shopping list items names