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

160
Views
Router is appending the path at the end

I have many component in react page. in my router file I have used them like below.

  <SecureRoute path="/new-inventory">
            <Inventory />
        </SecureRoute>

        <SecureRoute path="/list-inventory">
            <ListInventory />
        </SecureRoute>


        <SecureRoute exact path="/:id/edit" component={EditInventory} />

below path gets called within the component

   <SecureRoute exact path="/:id/edit" component={EditInventory} />

I am using below anchor tag.

<a href={/${props.inventory.id}/edit}>

path in browser gets generated like this

http://localhost:4200/36917491-4ef5-4fa2-87aa-c921986f94d1/edit

now if I click on otther tab for ex inventory then instead of coming url like http://localhost:4200/inventory it comes like http://localhost:4200/36917491-4ef5-4fa2-87aa-c921986f94d1/edit/inventory

means path gets appended instead of replacing. what should I do?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of using anchor tags use Link that comes with react-router. anchor tags will trigger page reload while Link do not.

import { Link } from "react-router-dom";

<Link to="/list-inventory">Inventory</Link>list-inventory
about 4 years ago · Juan Pablo Isaza Report
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!