0

I have a pdf that should download when user clicks on a button. The content for the pdf gets set:

const [instance, updateInstance] = usePDF({
    document: (
      <PDFDocument projectsData={projectsData} projectId={projectId} />
    ),
  });

When projectsData is updated I call updateInstance. But the content of the PDF still reflects the original projectsData, and not the updated.

I have tried calling updateInstance in a useeffect when projectsData is updated as well.

Scootz13
  • 1
  • 1

1 Answers1

0

I'm not 100% sure, since you haven't provided more code, however my working code doesn't use parentheses/brackets after the document parameter. So my approach using your code would look like this:

const [instance, updateInstance] = usePDF({
    document: <PDFDocument projectsData={projectsData} projectId={projectId} />
});

Hope this helps

Jindra
  • 1
  • 1
  • 1
  • 2