I use this to download -
<a href={`${link}`} download="file">Download</a>
But it's not working for me. I use the Chrome browser. It just opens the file in the browser.
I use this to download -
<a href={`${link}`} download="file">Download</a>
But it's not working for me. I use the Chrome browser. It just opens the file in the browser.
 
    
    function download(fileUrl, fileName) {
 let a = document.createElement("a");
 a.href = fileUrl;
 a.setAttribute("download", fileName);
 a.click();
}
 
    
    Try adding target="_blank":
<a href={`${link}`} download="file" target="_blank" >Download</a>
