I'm making a React App and I'm getting this warning. I'm trying to make two API calls when the component mounts:
useEffect(() => {
getWebsites();
loadUserRatings();
}, []);
That's why I have an empty array, because I want to call it just once when the component gets mounted. But I'm still getting the warning, how can I fix it?
Those two functions are passed to the component using connect from react redux, the whole component looks like this:
const Wrapper = (props) => {
const { getWebsites, loadUserRatings } = props;
useEffect(() => {
getWebsites();
loadUserRatings();
}, []);
return (
<>
<Header />
<Websites />
<Sync />
</>
);
};