diff --git a/react/ui-components/src/atoms/UploadImage.js b/react/ui-components/src/atoms/UploadImage.js index 61acecf98b..6dc1f9adf9 100644 --- a/react/ui-components/src/atoms/UploadImage.js +++ b/react/ui-components/src/atoms/UploadImage.js @@ -34,15 +34,12 @@ const UploadImage = ({ } }; useEffect(() => { - window.addEventListener("resize", () => { - onResize(); - }); + window.addEventListener("resize", onResize); + return () => { - window.addEventListener("resize", () => { - onResize(); - }); + window.removeEventListener("resize", onResize); }; - }); + }, []); const selectfile = (e) => { handleChange(e); @@ -145,7 +142,7 @@ const UploadImage = ({