I am getting 2 typescript errors for el and modalRoot types. How should I declare el and modalRoot to get rid of typescript errors?
interface IModal {
closeModal: () => {};
title: string;
children: ReactNode
}
const Modal = (props: IModal) => {
const { closeModal, title, children } = props;
let el = null;
const modalRoot = document.getElementById('modal-root');
useEffect(() => {
el = React.createElement('div');
modalRoot.appendChild(el);
return () => modalRoot.removeChild(el);
}, []);
....
}