Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

247
Vistas
Gatsby (gatsby-plugin-transition-link) - refresh page when navigating to the same route

I'm using Gatsby's AniLink

import AniLink from "gatsby-plugin-transition-link/AniLink";
<AniLink paintDrip hex="#24B2D8" to="/home">
  <Image src={logoImg} width="220px" alt="Logo" />
</AniLink>

If I'm on a route that's different than home and click on the image (i.e: /about going to /home). It will seemingly route me accordingly, however if I'm on the home page already and click on the image then nothing happens. To improve UX, I want the page to refresh if the user attempts to navigate to a route that they're currently on. How would I go about doing this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Well, this is the expected behavior when dealing with Link component in React. AniLink it's an implementation of Gatsby's Link component which at the same time extends from @reach/router, from React. It won't refresh the page if you are trying to navigate to the same URL, that's the expected behavior because it has nothing to re-render, the rehydration never occurs because nothing changes.

That said, you can bypass this limitation by using the traditional anchor tag (<a>) which will force the navigation hence the page to re-render:

<a href="/home">
  <Image src={logoImg} width="220px" alt="Logo" />
</a>

Of course, you may need to add the paintDrip and the hex props by CSS or some other approach.

You can tweak this approach by only rendering this anchor if the user is on the home page, for the rest you can keep the AniLink component.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda