I'm using useEffect with several dependencies included in the dependency array, which are at the same time props. I want to ignore some dependencies (i.e. props.b) which are causing my page to render when these dependencies change; however, I have to include a dependency array because I want my useEffect to listen to other dependencies (i.e. props.a). This is my code very, very simplified:
const MyFunction(props){
const [c,setC] = useState([])
useEffect(()=>{
if (props.a){
let c0;
props.b.forEach((item)=>{
c0 = [...,c0.x]
})
setC(c0)
}
,[props.a])
return (
<div>
<OtherComponent
c={c}
/>
</div>
)
}
I don't know how to procede without getting a warning, as I really need to ignore props.b but not props.a