Search code examples
reactjsreact-to-print

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


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?


Solution

  • 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)