0.0.2 • Published 5 years ago

use-detect-print v0.0.2

Weekly downloads
409
License
MIT
Repository
github
Last release
5 years ago

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>
  );
}