component-portal
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

📦 Installation

npm install component-portal

🔨 Usage

class Test extends React.PureComponent {

    state = {
    };
    ref=React.createRef<HTMLDivElement>()
    render() {
        const {} = this.state;
        return (
            <div>
                <Portal getContainer={()=>this.ref.current}>123</Portal>
                <div ref={this.ref}>456</div>
                <div id='container'>789</div>
                <Portal getContainer={'#container'}>123</Portal>
            </div>
        );
    }
}

Package Sidebar

Install

npm i component-portal

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

40.9 kB

Total Files

6

Last publish

Collaborators

  • tspan