import React from 'react'
import 'rsuite/dist/styles/rsuite-default.css';
import { Portal } from 'rsuite';
export default function App() {
const [isVisible, setVisibility] = React.useState(false);
const box = React.useRef(null);
return (
<div style={{ display: 'block', padding: 30, width: 500 }}>
<h4>React Suite Portal Component</h4>
<button type="button" onClick={() => setVisibility(!isVisible)}>
{!isVisible ? 'Mount Children' : 'Unmount Children'}
</button>
<div style={{
backgroundColor: 'yellow',
border: '5px solid black',
}}>
Sample Text
{isVisible ? (
<Portal container={box.current}>
<span>Your Data is Mounted here :)</span>
</Portal>
) : null}
<div style={{
backgroundColor: 'orange',
border: '5px solid black',
}} ref={box} />
</div>
</div>
)
}