Skip to content

Commit fd7585e

Browse files
committed
Use React.useCallback for useDialog Dialog component
1 parent d74c141 commit fd7585e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Modal/Modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ const useDialog = () => {
8787
dialogRef.current?.close()
8888
}, [dialogRef])
8989

90-
const Dialog = ({ children, ...props }: DialogProps) => {
90+
const Dialog = useCallback(({ children, ...props }: DialogProps) => {
9191
return (
9292
<Modal {...props} ref={dialogRef}>
9393
{children}
9494
</Modal>
9595
)
96-
}
96+
}, [dialogRef])
9797
Dialog.displayName = 'Dialog'
9898
return { dialogRef, Dialog, handleShow, handleHide }
9999
}

0 commit comments

Comments
 (0)