Skip to content

Commit

Permalink
Merge pull request #19 from the-collab-lab/sm-eb-read-shopping-list-a…
Browse files Browse the repository at this point in the history
…nd-items

Looped data into List.jsx and into Home.jsx
  • Loading branch information
EmmaBin authored Aug 18, 2024
2 parents 02f3ffe + 2ffcca0 commit 5b7c9c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
17 changes: 12 additions & 5 deletions src/views/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import './Home.css';

import { SingleList } from '../components';
export function Home({ data, setListPath }) {
return (
<div className="Home">
<p>
Hello from the home (<code>/</code>) page!
</p>
<ul>
{/**
* TODO: write some JavaScript that renders the `lists` array
* so we can see which lists the user has access to.
*/}
{data &&
data.map((list) => {
return (
<SingleList
key={crypto.randomUUID()}
name={list.name}
setListPath={setListPath}
path={list.path}
/>
);
})}
</ul>
</div>
);
Expand Down
9 changes: 4 additions & 5 deletions src/views/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ export function List({ data }) {
Hello from the <code>/list</code> page!
</p>
<ul>
{/**
* TODO: write some JavaScript that renders the `data` array
* using the `ListItem` component that's imported at the top
* of this file.
*/}
{data &&
data.map((list) => {
return <ListItem key={list.id} name={list.name} />;
})}
</ul>
</>
);
Expand Down

0 comments on commit 5b7c9c3

Please sign in to comment.