While the NotFound component is being loaded, I want to process the method I sent as props by giving a value as a parameter. I also used useEffect for this. As it stands, I get what I want but I get the following warning and I couldn't find how to get rid of it!!!
import React, { useEffect } from "react";
import NotFound404 from "../assets/images/nfx404.png";
import { motion } from "framer-motion";
import { Link } from "react-router-dom";
import { Screen404ButtonsVariant } from "../Helpers/Variants";
import { FaHandPointLeft } from "react-icons/fa";
const NotFound = ({ chageFooterColorsHandler }) => {
useEffect(() => {
chageFooterColorsHandler("#0e37633c", "#0E3763");
}, []);
return (
<div className="notfound-container">
<img src={NotFound404} alt="notfoundpage" />
<motion.div
className="div-navigation-button"
variants={Screen404ButtonsVariant}
initial="hidden"
animate="visible"
>
<Link to="/" className="btn btn-outline-navy">
<span>
<FaHandPointLeft
onClick={() =>
chageFooterColorsHandler(
"rgba(220, 20, 60, 0.3)",
"rgba(220, 20, 60, 1)"
)
}
/>
</span>
</Link>
</motion.div>
</div>
);
};
export default NotFound;
Line 11:6: React Hook useEffect has a missing dependency: 'chageFooterColorsHandler'. Either include it or remove the dependency array. If 'chageFooterColorsHandler' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps
How can I solve this warning in React.js? Thank you!