New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-print-component

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-print-component

Print your component!

latest
npmnpm
Version
0.1.8
Version published
Maintainers
1
Created
Source

React Print Component

Print your component!

Arguments

NameTypeDefaultDescription
singlePagebooleanAdd a react-print-single class to print <div>

Example Usage

  • Add <PrintComponent /> Element to your root element

    
    ...
    
    render() {
        return (
            <div>
                <PrintComponent />
                <div className="main-root"></div>
            </div>
        );
    }
    
    ...
    
    
  • Use static functions to print your components.

    import PrintComponent from 'react-print-component';
    
    export class TestComponent() {
    
        ...
    
        onPrintButtonClick() {
            //Replace components added
            PrintComponent.SetPrintContent(this.render());
            //Add components to list
            PrintComponent.AddPrintContent(this.render());
            PrintComponent.AddPrintContent(<div>{"Mulit element"}</div>);
            //Clear all added components in list
            PrintComponent.ClearComponent();
            ...
            do something
            ...
    
            //Call this method to print
            PrintComponent.Print();
        }
    
        ...
    }
    
  • Write print style in @media

        @media print {
            
            ...
            
            h1 {}
            h2 {}
            button {}
            input[type=text] {}
    
            ...
        }
    

FAQs

Package last updated on 01 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts