When I change the code as following I was success.
const printRef = useRef<HTMLDivElement>(null); const handlePrint = useReactToPrint({ contentRef: printRef, documentTitle: `My_HeaderText_Print_${userId}`, onAfterPrint: () => console.log('Printing completed'), }); console.log(componentRef.current);
react-to-print version 3.0.4