refactor: PropsWithChildren

This commit is contained in:
Tristan Yang
2022-08-29 10:33:53 +08:00
parent d57072f2be
commit d40afe1500
3 changed files with 8 additions and 17 deletions
+2 -3
View File
@@ -1,13 +1,12 @@
import { FC, ReactNode, useEffect, useState } from "react";
import { FC, useEffect, useState, PropsWithChildren } from "react";
import { createPortal } from "react-dom";
interface Props {
id?: string;
mask?: boolean;
children?: ReactNode;
}
const Modal: FC<Props> = ({ id = "root-modal", mask = true, children }) => {
const Modal: FC<PropsWithChildren<Props>> = ({ id = "root-modal", mask = true, children }) => {
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
useEffect(() => {