use-detect-print

0.0.2 • Public • Published

use-detect-print

React Hook to detect printing

Installation

npm install use-detect-print --save

Usage

import React from 'react';
import useDetectPrint from 'use-detect-print';
 
function App() {
 
  const isPrinting = useDetectPrint();
 
  return (
    <div>
     <span>Is it printing? </span>      
     {isPrinting ? (
       <span style={{ color: 'green', fontSize: 50 }}>Yes</span>
     ): (
       <span style={{ color: 'red' }}>No!</span>
     )}
    </div>
  );
}
 

Package Sidebar

Install

npm i use-detect-print

Weekly Downloads

102

Version

0.0.2

License

MIT

Unpacked Size

3.16 kB

Total Files

3

Last publish

Collaborators

  • gregnb