Throw React elements (ex: modal, dialog, toaster) to external using elements (usually used for
https://react.dev/reference/react-dom/createPortal
- Pass the component to the external Dom through the portal
yarn add @acrool/react-portal
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: