Skip to content

Commit f9dad38

Browse files
committed
Making components better
1 parent f3fe1c3 commit f9dad38

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/layouts/contacts/id/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ function Contact() {
44
let { id } = useParams();
55
return (
66
<div>
7-
<h1>{id}</h1>
8-
<img src={`https://picsum.photos/id/${id}/200/300`} />
7+
<h1>Contact Details for: {id}</h1>
8+
<img
9+
src={`https://picsum.photos/id/${id}/200/300`}
10+
loading="lazy"
11+
alt={id}
12+
/>
913
</div>
1014
);
1115
}

src/layouts/contacts/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ import { Link } from "react-router-dom";
22

33
function Contacts() {
44
return (
5-
<ul>
6-
{[1, 2, 3, 4, 5].map((contact) => (
7-
<li key={contact}>
8-
<Link to={`${contact}`}>{contact}</Link>
9-
</li>
10-
))}
11-
</ul>
5+
<div>
6+
<h1>All Contacts</h1>
7+
<ul>
8+
{Array.from(
9+
{ length: 10 },
10+
() => Math.floor(Math.random() * 100) + 1
11+
).map((contact) => (
12+
<li key={contact}>
13+
<Link to={`${contact}`}>{contact}</Link>
14+
</li>
15+
))}
16+
</ul>
17+
</div>
1218
);
1319
}
1420

0 commit comments

Comments
 (0)