Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

663
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda