In my React Native app, I have a variable var1 that gets updated 10 times, and on the 10th time another variable flag gets set to true. I want to trigger useEffect on var1 only when flag == true. Is there a way to do this?
useEffect({
if(var1===10){
setFlag(true)
}
},[var1])
useEffect({
if(flag){
//write your code here
}
},[flag])