Skip to content

Files

Latest commit

45043a7 Β· Sep 15, 2021

History

History
35 lines (26 loc) Β· 543 Bytes

usePrint.md

File metadata and controls

35 lines (26 loc) Β· 543 Bytes

πŸ–¨ usePrint

Preview and Print any block of html

Arguments

  • style: Object: style to be passed to the preview

Returns

{
  ref: Ref: Click outside of this element,
  handlePrint: Function - will start the print preview process
}

Usage

import { usePrint } from 'react-recipes';

const App = () => {
  const { ref, handlePrint } = usePrint();

  return (
    <div ref={ref}>
      Hello World
      <button onClick={handlePrint} type="button">
        Print This Block
      </button>
    </div>
  );
};