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

207
Vistas
How to track , on url change in React app

this is App.js - this is good

<Route path='/page1'>
     <Page1 />
 </Route>

this is "/page1"

var location = window.location.href
<Link to="/page1/2">
    <p>Click to change</p>
</Link>

if i click on that paragraf it change url into /page1/2 but var location isnt changed its still /page1 -------------------------------------------------------------------------------------------------------------------- I want when url chaged to set var location to new location (window.location.href)(/page1/2)

// or i need just show me how to "on url changed" do something what-ever maybe alert('url changed') or console.log('url changed')

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

0

If you are using react-router, use useLocation hook to get the path.

import React from "react";
import { useLocation } from "react-router-dom";

export const App = () => {
  let location = useLocation();
  return <div>...</div>;
}
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