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

180
Visualizações
NotFound page rendering above all components

I've had a problem with rendering NotFound page with the following code, component Routing is a children in my Switch component located in App.tsx:

const Routing = (): JSX.Element => {
  return (
    <>
      {publicRouting.map(({ path, component }, i) => (
        <Route key={i} path={path} component={component} />
      ))}
      {isAuthenticated() && (
        <Main>
          {routing.map(({ path, component }, i) => (
            <Route exact key={i} path={path} component={component} />
          ))}
        </Main>
      )}
    </>
  );
};

my publicRouting and routes used above:

export const publicRoutes = {
  login: "/login",
  notFound: "*"
};

export const publicRouting = [
  { path: publicRoutes.login, component: Login },
  { path: publicRoutes.notFound, component: NotFound }
];

can someone tell me why, after logging in to private routes (isAuthenticated() === true) my NotFound page is always rendering above the Main component?

Here is the small screenshot of this situation, NotFound component is physically rendering above the Main component and his children enter image description here

If anyone want more code then it feel free, I will paste it

thanks for any 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