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

199
Views
Why is the download button using anchor tag in react js not working?

hello i want to create a download button in react js, so that user can download a pdf file by clicking that button. i used the anchor tag with download attribute but it is not working. when i click the download button, it says "failed no file" in the small pop up window.

<a href="./test.pdf" download> Download </a>

The pdf file is in the src folder.

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

0

inside the file that has

<a href="./test.pdf" download> Download </a>

do this rather

import testPDF from './test.pdf';
<a href={testPDF} download> Download </a>

this solution will work, assuming both the pdf and the jsx file are within the same directory "./src"

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!