I'd opt for introducing a state variable that shows whether the code inside the effect has executed. Then, inside the effect of course, you set the variable to true. In this way, the code is more explicit of what is happening, although it is not so savvy so to say.