Problem with react-pdf library, when using usePDF hook

Viewed 1227

I use usePDF hook to download rendered pdf file, and it works correctly, but when i move to another page and come back to pdf page, button stops working. I check instance after returning from another page and blob file in it becomes null

const [instance, updateInstance] = usePDF({ document: ShowPdf() }) // ShowPdf is a function that returns <document>...pdf content</document>

How can I fix this problem? My library https://react-pdf.org/

This is my instance before moving to another page/component enter image description here

This is after returning from another page/component enter image description here

1 Answers

Instantiating component as JSX component worked for me -

const [instance, updateInstance] = usePDF({ document: <ShowPdf/> })
Related