PteroTheme/resources/scripts/components/elements/Portal.tsx

9 lines
275 B
TypeScript
Raw Normal View History

2022-06-20 19:16:42 +01:00
import React, { useRef } from 'react';
import { createPortal } from 'react-dom';
export default ({ children }: { children: React.ReactNode }) => {
const element = useRef(document.getElementById('modal-portal'));
return createPortal(children, element!.current!);
};