5 ms·
For anyone curious, here's a proof-of-concept of how to implement a <Modal> that manages its own transition out when it's unmounted using just ReactDOM.createPo
by jitl 1y ago
For anyone curious, here's a proof-of-concept of how to implement a <Modal> that manages its own transition out when it's unmounted using just ReactDOM.createPortal and React.useLayoutEffect.
https://stackblitz.com/edit/react-modal-with-transition-out?devToolsHeight=33&file=src%2FApp.js https://stackblitz.com/edit/react-modal-with-transition-out?...
- chamomeal 1y agoawesome thanks!! Ok it all makes sense now. I’d forgotten about useLayoutEffect. Haven’t had to write much react recently.