I have a little bit of doubt in the useEffect function. I am trying to stop the unnecessary condition with useEffect. the question is can I control the useEffect with condition and is it possible?. the example code,
it is normal code,
useEffect(() => {
// do something
},[variableName]);
my expectation code and question is,
useEffect(() => {
// do something
},[variableName == 5]); // if it's true, Does the useEffect control the re-run?
it's like an if condition and is it possible to stop the re-run. I know it's weird but just for my clear understanding.
Thank you.