useAmIPrinting

A simple React hook for detecting if the browser is printing.

github.com/joeblas/use-am-i-printing

How to use

Put the hook in a React file. Detect whether or not the browser is printing the page.

Examples

Set and grab message

Input:

const isPrinting = useAmIPrinting();

Output:

No, I am not printing.

Tip:

Try printing this page. Notice how the output above changes.