When the user clicks on download pdf I want to show the corresponding date and time. This below code shows date and time when the file first loaded in application not when the user click on download. How to show current timestamp in pdf?(when the user clicks on download). How to make use of updateInstance method?
import { usePDF, Document, Page } from '@react-pdf/renderer';
const MyDoc = (
<Document>
<Page>
<Text>{new Date().toLocaleString()}</Text>
</Page>
</Document>
);
const App = () => {
const [instance, updateInstance] = usePDF({ document: MyDoc });
if (instance.loading) return <div>Loading ...</div>;
if (instance.error) return <div>Something went wrong: {error}</div>;
return (
<a href={instance.url} download="test.pdf">
Download
</a>
);
}