mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
15 lines
357 B
TypeScript
15 lines
357 B
TypeScript
import memoize from 'lodash/memoize';
|
|
|
|
const getModalPortal = memoize(() => {
|
|
let portal = document.getElementById('modal-portal') as HTMLDivElement;
|
|
if (!portal) {
|
|
portal = document.createElement('div');
|
|
portal.setAttribute('id', 'modal-portal');
|
|
document.body.appendChild(portal);
|
|
}
|
|
|
|
return portal;
|
|
});
|
|
|
|
export default getModalPortal;
|