mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 13:38:51 +00:00
Fix asynchronous error
This commit is contained in:
@@ -3,19 +3,15 @@ import { forwardRef } from 'react';
|
||||
// Styled
|
||||
import { StyledBody, StyledDialog, StyledTitle } from './styled';
|
||||
|
||||
export interface IDialogProps<T> {
|
||||
export interface IDialogProps {
|
||||
title?: string;
|
||||
children?: JSX.Element[] | JSX.Element;
|
||||
onClose?: () => void;
|
||||
reload?: boolean;
|
||||
setReload?: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
ref?: React.MutableRefObject<HTMLDialogElement | undefined>;
|
||||
data?: T | null;
|
||||
isAdd?: boolean;
|
||||
ref?: React.MutableRefObject<HTMLDialogElement | null>;
|
||||
}
|
||||
|
||||
const Dialog = forwardRef((props, ref) => {
|
||||
const { title, children, onClose } = props as IDialogProps<unknown>;
|
||||
const Dialog = forwardRef((props: IDialogProps, ref) => {
|
||||
const { title, children, onClose } = props;
|
||||
return (
|
||||
<StyledDialog
|
||||
ref={ref as React.LegacyRef<HTMLDialogElement> | undefined}
|
||||
@@ -25,6 +21,6 @@ const Dialog = forwardRef((props, ref) => {
|
||||
<StyledBody>{children}</StyledBody>
|
||||
</StyledDialog>
|
||||
);
|
||||
}) as React.FC<IDialogProps<unknown>>;
|
||||
});
|
||||
|
||||
export default Dialog;
|
||||
|
||||
Reference in New Issue
Block a user