How to print the entire page in react-to-print

1.9k Views Asked by At

I have a print button that works great in react-to-print


     const handlePrint = useReactToPrint ({
         content: () => printRef.current,
     });

<div ref = {printRef}> this will print </div>

My question is how can I print the entire page and not just a single component?

1

There are 1 best solutions below

5
Muhammad Qasim Qadri On BEST ANSWER

You can use this same function to the parent component of the page.(Where all the code has written for the specific page to be print)