I need to call useEffect when ever data changes like below,
useEffect(()=>{
const filteredData = reduxArray.filter(
() => // do something
);
store.dispatch(method({reduxArray:[...filteredData]}))
},[data])
this actually meets my requirement and works fine for me but Eslint is not happy with the same and gives me the error React Hook useEffect has a missing dependency: 'reduxArray'. Either include it or remove the dependency array.
In that case if I add reduxArray in the dependency array then it causes infinite loop in the useEffect since I am updating reduxArray in the useEffect. Is there a way other than disabling eslint to overcome this ?