Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

207
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda