npm.io
1.1.2 • Published 1 year ago

@acrool/react-portal

Licence
MIT
Version
1.1.2
Deps
0
Size
8 kB
Vulns
0
Weekly
0
Stars
8

Acrool React Portal

Acrool React Portal Logo

Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for

NPM npm npm

npm downloads npm

https://react.dev/reference/react-dom/createPortal

^1.1.0 support react >=18.0.0 <20.0.0

Features

  • Pass the component to the external Dom through the portal

Install

yarn add @acrool/react-portal

Usage

add in your App.tsx

import ReactPortal from '@acrool/react-portal';

const App = () => {
    return (
        <ReactPortal
            id="acrool-react-modal"
            className={styles.root}
        >
            {item && renderDialog()}
        </ReactPortal>
    );
};

There is also a example that you can play with it:

Play react-editext-example

Play react-editext-example

Play react-editext-example

With application

License

MIT Acrool & Imagine

Keywords