How can I remove warnings like this error srccomponentspagesbadgeBadgeScreen.tsx Line 87:6: React Hook useEffect has a missing dependency: 'loadData'. Either include it or remove the dependency array react-hooks/exhaustive-deps
Here is my code:
const location = useLocation();
const { badge }: any = location.state;
const [data, setData] = useState({
id: "",
badge_name: "",
badge_description: "",
imgBase64: "",
img_icon: "",
});
useEffect(() => {
setData(badge);
}, [badge]);
Everything is working fine, but I am having a hard time fixing this issue.
Thank you!