I have this drawer
const MyDrawer = ({onClose, onSwapToModal, open, portalNode}: MyDrawerProps) => {
return (<Drawer
sx={{
width: 240,
flexShrink: 0,
'& .MuiDrawer-paper': {
width: 240,
},
}}
variant="persistent"
anchor='right'
open= {open}
onClose={onClose}>
<Toolbar/>
<MyDrawerHeader onClose={onClose} onSwapToModal={onSwapToModal}/>
<portals.OutPortal node={portalNode}/>
</Drawer>);
}
I have setup portals so that i could switch between modal representation and Sidebar representation. If i open up sidebar first, then it has content, but if i now switch between modal and back, drawer loses its content. For portals im using react-reverse-portal.