I am trying to clean up the warnings in my DOM, and for every useEffect where the deps are [] I get an error that says useEffect has a missing dependency. I want to trigger the effect when the component mounts, and I was under the impression that this was the way to do it. If thats the case, why the warning?
Here is the simple code im using
useEffect(() => {
setDispContext("NEW");
}, []);
Warning is React warning React Hook useEffect has a missing dependency: 'setDispContext'. Either include it or remove the dependency array react-hooks/exhaustive-deps