Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!