1.0.1 ā€¢ Published 3 years ago

component-portal v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

šŸ“¦ 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>
        );
    }
}