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

199
Vistas
In react component, location.href doesnt seem to redirect

I have a very simple scenario in which I need to redirect to an external domain in react something like this on change of a switch:

handleSwitch={() => {
                location.href = 'https://www.google.com/'; // oldAppUrl;
                    // window.open(oldAppUrl, '_href')
                }}

However, this is not working. What am I missing?

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

0

Try like this:

window.location.href = 'https://www.google.com/';

and this should work too, using it in an app:

window.location = 'https://www.google.com/';

If none of these two works it means your handleSwitch function is probably not called, then you should show us some more code to help with the solving.

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