RE

React To Print

react-to-print

Print React components in the browser

Utilities
react
print
reactjs
react-to-print
Utilities
javascript
npm
frontend
open source
ui
Stars
2.5k
Weekly
1.1M
Open issues
18
Bundle
~25 kB

Installation

npm install react-to-print

Code example

import { useToPrint } from "react-to-print";

export function Example() {
  const value = useToPrint();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by Matthew Herbst
  • 1.1M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 18 open issues on GitHub

FAQs

Alternatives & similar libraries