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

662
Vistas
How to pass data through single-spa navigateToUrl()?

I was using <Link> from @material-ui/core/Link and passing data like below:-

<Link
      to={{
        pathname: PATH,
        search: window.location.search,
        state: {
          isData: true,
        },
      }}
    >

Now, I'm switching to single-spa like below:-

import * as singleSpa from 'single-spa';    
   <Link 
      href={`${PATH}${window.location.search}`} 
      onClick={(e) => {
            e.preventDefault();
            singleSpa.navigateToUrl(
              `${PATH}${window.location.search}`,
            );
            
     }}>
  

But in above case I am unable to pass state: {isData: true}

Here's the module for navigationToUrl:-

export function navigateToUrl(
    obj:
      | string
      | {
          currentTarget: {
            href: string;
          };
          preventDefault: any;
        },
    opts?: Object
  ): void;

I tried the following to replicate the structure but isData isn't getting passed:-

 <Link
      href={`${PATH}${window.location.search}`}
      onClick={(e) => {
        singleSpa.navigateToUrl(
          {
            currentTarget: {
              href: `${PATH}${window.location.search}`,
            },
            preventDefault: e.preventDefault(),
          },
          {
            isData: true,
          },
        );
      }}
    >

Also, preventDefault comes to be undefined if I do above. Can someone help?

about 4 years ago · Juan Pablo Isaza
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