Next.js Discord

Discord Forum

Link route downloads file from href on every re-render

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
After i click the link, a pdf file gets downloaded. But then if the component where the link is rendered gets re-rendered my pdf downloads again. Is this the correct way of downloading a file? How can I fix this?

            const invoice_pdf = "https://invoice.stripe.com/i/acct_1NDkq7C...82m3H?s=ap"

            <Link href={invoice_pdf}>
              Download
            </Link>
 

0 Replies