I want to print the facture of selling , for that i used useReactToPrint but the problem is that it takes the last update of my values, for example if i add two numbersin the selling price field it only shows the first one in the print pdf page, i think the problem is with the useRef ... I want the handlePrint function to be excuted at every update .Here is some part of the code:
const invoiceRef: MutableRefObject<any> = useRef();
const handlePrint = useReactToPrint({
content: () => invoiceRef.current,
removeAfterPrint: true,
});
const printSellingInvoice: React.FC<ISellingInvoiceRequest> = (props) => {
const intl = useIntl();
return (
<div className="invoice">
.
.
.
</div>
);
};