DEV Community

Vehbi Restelica
Vehbi Restelica

Posted on

Can we make a download button in ReactJs?

Hi devs,
I was wondering if there is any option to make a download button with reactjs, so the viewers can download a file.
I wanted to make a "download my resume" button on my portfolio.

Thanks in advance :)

Discussion (3)

giseleml profile image
Gisele Leonardi • Edited on

Yes you can, all you have to do is pass your download function to the onClick event!

const onDownload = () => console.log('Download')

<button onClick={onDownload}>Download My Resume</button>
Enter fullscreen mode Exit fullscreen mode
vehbirestelica profile image
Vehbi Restelica Author

Okay, but is there any library, method to add PDF viewer in react?

giseleml profile image
Gisele Leonardi

Yeah of course. The most popular is react-pdf