diff --git a/src/App.js b/src/App.js index de1cfd5..1b1c414 100644 --- a/src/App.js +++ b/src/App.js @@ -12,6 +12,7 @@ function App() { const [pets, setPets] = useState([]); const [page, setPage] = useState(1); const [totalPages, setTotalPages] = useState(1); + let content, pagination; useEffect(() => { async function fetchData() { @@ -33,6 +34,14 @@ function App() { setPage(data.activePage); }; + if(pets.length > 0) { + content = {pets.map(pet => PetCard(pet))}; + pagination = ; + } else { + content =

Where are our pets ?

It seems like these guys are playing hide and seek.
They'll be back once we find them.

; + pagination = ''; + } + return (
@@ -43,15 +52,11 @@ function App() {
- {pets.map(pet => PetCard(pet))} + {content}
- + {pagination}
);