forked from crowetic/commerce
Fix useCallback
This commit is contained in:
parent
66b8bdb6bb
commit
e593eab9cc
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user