Skip to content

Commit

Permalink
Merge pull request #43 from the-collab-lab/sm-fix-key-bug
Browse files Browse the repository at this point in the history
Add more keys and unique key props
  • Loading branch information
sar-mko authored Sep 30, 2024
2 parents 695a2d3 + a2835ba commit fed03fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/views/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './Home.css';
import { SingleList } from '../components';
import { useState } from 'react';
import { Fragment, useState } from 'react';
import { createList, useAuth } from '../api';
import { useNavigate } from 'react-router-dom';

Expand Down Expand Up @@ -40,15 +40,15 @@ export function Home({ data, setListPath }) {
<ul>
{data &&
data.map((list) => {
const uniqueId = crypto.randomUUID();
return (
<>
<Fragment key={uniqueId}>
<SingleList
key={crypto.randomUUID()}
name={list.name}
setListPath={setListPath}
path={list.path}
/>
</>
</Fragment>
);
})}
</ul>
Expand Down
8 changes: 4 additions & 4 deletions src/views/List.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ListItem } from '../components';
import { useState, useEffect } from 'react';
import { useState, useEffect, Fragment } from 'react';
import BasicModal from './Modal';
import { comparePurchaseUrgency } from '../api';

Expand Down Expand Up @@ -82,14 +82,14 @@ export function List({ data, userId }) {
<ul>
{filteredObject &&
Object.entries(filteredObject).map(([timeBucket, list]) => (
<>
<Fragment key={crypto.randomUUID()}>
<div>
<h3>{labels[timeBucket]}</h3>
</div>
{list.map((item) => (
<ListItem key={item.id} item={item} />
<ListItem item={item} key={crypto.randomUUID()} />
))}
</>
</Fragment>
))}
</ul>
</>
Expand Down

0 comments on commit fed03fa

Please sign in to comment.