JSFiddle - React, Tailwind, and code Playground

HTML

<script src=" //cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<body>
  <!-- This will print your page exactly how it looks in the browser -->
  <button class='print'>Print</button>
</body>

CSS

.print {
  background-color: red
}

JavaScript

// add print button function

	
	$('.print').on('click', function(){		
		html2canvas(document.body, {
	        onrendered: function(canvas) {
	        	
	        	$("#page").hide();
	            document.body.appendChild(canvas);
	            window.print();
	            $('canvas').remove();
	            $("#page").show();
	        }
	    });
	    
	});