Sootzani/components/PrintPage.tsx

15 lines
387 B
TypeScript

import React from 'react'
import { Button } from './ui/button'
export default function PrintPage() {
function handlePrint() {
window.print()
//the window.print() command is what is telling the browser to print the page
}
return (
<Button onClick={handlePrint}> Print </Button>
//the onClick function is built into React to look for a click event!
)
}