fix current warnings

This commit is contained in:
Mounir
2023-08-10 17:16:11 +02:00
parent 8624237760
commit f552e5cb69
5 changed files with 26 additions and 20 deletions

View File

@@ -57,13 +57,13 @@ const Modal: React.FC<ModalProps> = ({ children, isOpen, closeModal }) => {
}
};
const handleEscPress = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
closeModal();
}
};
React.useEffect(() => {
const handleEscPress = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
closeModal();
}
};
if (isOpen) {
window.addEventListener('keydown', handleEscPress);
}
@@ -71,7 +71,7 @@ const Modal: React.FC<ModalProps> = ({ children, isOpen, closeModal }) => {
return () => {
window.removeEventListener('keydown', handleEscPress);
};
}, [isOpen]);
}, [isOpen, closeModal]);
if (!isOpen) {
return null;

View File

@@ -1,4 +1,4 @@
import { useEffect } from "react";
import { useEffect, useMemo } from "react";
const FancyBackground = (): JSX.Element => {
@@ -25,7 +25,7 @@ const FancyBackground = (): JSX.Element => {
return result;
};
const App: any = {};
const App: any = useMemo(() => [], []);
App.setup = function () {
@@ -335,7 +335,7 @@ const FancyBackground = (): JSX.Element => {
requestAnimationFrame(frame);
};
frame();
}, []);
}, [App]);