From a03b513d9d07910b82572723e97b3d67e8c563bb Mon Sep 17 00:00:00 2001 From: Emisael Kisler Date: Wed, 28 Aug 2024 08:07:34 -0400 Subject: [PATCH] part11-7 OK --- src/App.jsx | 7 +++---- src/PokemonPage.jsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 04a18ed889..9ce4fcb642 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,5 +1,5 @@ import React from "react"; -import { BrowserRouter as Routes, Route, useMatch } from "react-router-dom"; +import { Routes, Route, useMatch } from "react-router-dom"; import { useApi } from "./useApi"; import LoadingSpinner from "./LoadingSpinner"; import ErrorMessage from "./ErrorMessage"; @@ -14,6 +14,8 @@ const mapResults = ({ results }) => })); const App = () => { + let next = null; + let previous = null; const match = useMatch("/pokemon/:name"); const { data: pokemonList, @@ -28,9 +30,6 @@ const App = () => { return ; } - let next = null; - let previous = null; - if (match && match.params) { const pokemonId = pokemonList.find( ({ name }) => name === match.params.name diff --git a/src/PokemonPage.jsx b/src/PokemonPage.jsx index 77479b0f7f..3f35452479 100644 --- a/src/PokemonPage.jsx +++ b/src/PokemonPage.jsx @@ -40,7 +40,7 @@ const PokemonPage = ({ previous, next }) => {
{previous && Previous} Home - {next && Next} + {next && Next}