forked from btholt/complete-intro-to-react-v5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResults.js
More file actions
34 lines (32 loc) · 780 Bytes
/
Results.js
File metadata and controls
34 lines (32 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from "react";
import Pet from "./Pet";
const Results = ({ pets }) => {
return (
<div className="search">
{!pets.length ? (
<h1>No Pets Found</h1>
) : (
pets.map(pet => {
let breed;
if (Array.isArray(pet.breeds.breed)) {
breed = pet.breeds.breed.join(", ");
} else {
breed = pet.breeds.breed;
}
return (
<Pet
animal={pet.animal}
key={pet.id}
name={pet.name}
breed={breed}
media={pet.media}
location={`${pet.contact.city}, ${pet.contact.state}`}
id={pet.id}
/>
);
})
)}
</div>
);
};
export default Results;