I use react hook useEffect like the following code for fetching data and changing state in it. For avoiding the infinite loop I add an empty array as the second parameter of the useEffect and I get this warning. Do I just ignore it or I have to fix it? If so, how can fix it? I just want the componentDidMount effect here. I appreciate any idea?
useEffect(() => {
fetch('/login')
.then(response => {
if (response.ok) fetchAll()
else setLoading({ ...loading, signin: true, progress:false });
}).catch(() =>{
setLoading({ ...loading, signin: true, progress:false });
})
},[]);