-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should updateInstance
have an argument?
#1537
Comments
You need to try something like: const [instance, updateInstance] = usePdf({ document: <Document data={data} /> });
updateInstance() // This does not receive any argument, it just make another pdf file. |
Yes, sir, I am aware of the same. But, I need to update the instance to render another Document and not the same one. |
For example, while updating a state, I need to specify what to update the state to (I send that as an argument). I can achieve this updating functionality if, I generate a PDF using const [documentHolder, setDocumentHolder] = useState(<DefaultDocument />);
/** SOME OPERATIONS **/
if (user.type === 'sales' && user.permissions === 'admin'){
setDocumentHolder(<TopSecretSalesDocument {...allTheRequiredProps} />)
}
return (
<SOME.PARENT>
{documentHolder && <PDFDownloadLink document={documentHolder} />}
</SOME.PARENT>
) ^ This works and does enable us to change the document that is supposed to be rendered. |
updateInstance
have an argument?updateInstance
have an argument?
Description
If I want to update my PDF instance then, I need to send an argument to update it with something.
Like, a whole new document.
But, this doesn't work.
updateInstance
doesn't seem to accept an argument. (I have linked the code below)react-pdf/packages/renderer/src/dom/usePDF.js
Lines 66 to 71 in bef5d6e
The text was updated successfully, but these errors were encountered: