react-to-pdf
react-to-pdf copied to clipboard
The toPDF function in usePDF should return a Promise object
Hello, I believe the type of toPDF
should not be void
, but rather a promise. This way, we can utilize the Promise to access subsequent states and related functions, enabling us to perform more operations.
type UsePDFResult = {
/**
* React ref of the target element
*/
targetRef: MutableRefObject<any>;
/**
* Generates the pdf
*/
toPDF: (options?: Options) => void;
};
change
type UsePDFResult = {
/**
* React ref of the target element
*/
targetRef: MutableRefObject<any>;
/**
* Generates the pdf
*/
toPDF: (options?: Options) => Promise<InstanceType<typeof jsPDF>>;
};