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

194
Views
Why does Google Chrome is opening my React App instead of the API?

I have a link in my react app supposed to open in an another page a pdf but google chrome is opening the react application instead of my api that renders the pdf The url of my pdf is /api/file/:_id and my react app is at / Express routes below :

app.use("/api/file", fileRouter)
app.get("*", (req, res) => {
    return res.sendFile(path.join(__dirname, "/front/build/index.html"))
})

When I click on my link

<a href={`/api/file/${invoice._id}`} target="_blank" rel="noreferrer">link</a>

chrome is opening the react page and not my file whereas Safari open my file.

Thanks for your help.

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

0

In react you should use <Link> component from react-router-dom.
react-router

If you want to redirect to outside website, you have to do something like:
<Link to={{pathname: "//www.stackoverflow.com/"}} target="_blank">StackOverflow</Link>

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!