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

128
Visualizações
If you refresh react, you will be taken to the main page

After building the react environment with react-create-app --typescript, I used the Route, Redirect, and Switch functions with react-router-dom.

App.tsx

  <Switch>
    <QueryClientProvider client={queryClient}>
    <Redirect exact path="/" to="/main" />
    <Route path="/main" component={Main} />
    <Route path="/product/:id" component={Product} />
    <Route path="/search" component={Search} />
    </QueryClientProvider>
    </Switch>

index.tsx


    <BrowserRouter>
    <App />
    </BrowserRouter>,

Strangely dynamic page www.localhost:3000/product/1 2 3 4

In this way, if you try to enter after entering the domain, you will automatically be directed to the main page.

And click the dynamic id value on the main page to move to the id value detail page. If you refresh the detail page, you are automatically moved to the main main page. Why are you doing this? Redirect is not used.

I can't find the problem.

If you refresh the search component page other than the main page, you will be redirected to the main main page. I really don't know why this is.

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