4
0
forked from crowetic/commerce

Fix useCallback

This commit is contained in:
Belen Curcio 2021-01-09 12:39:18 -03:00
parent 66b8bdb6bb
commit e593eab9cc

View File

@ -19,12 +19,14 @@ interface Props {
const Modal: FC<Props> = ({ children, open, onClose, onEnter = null }) => {
const ref = useRef() as React.MutableRefObject<HTMLDivElement>
const handleKey = (e: KeyboardEvent) =>
useCallback(() => {
const handleKey = useCallback(
(e: KeyboardEvent) => {
if (e.key === 'Escape') {
return onClose()
}
}, [onClose])
},
[onClose]
)
useEffect(() => {
if (ref.current) {