I'v taken a look here but the selected answer does not answer the question. I'm looking for a componentWillMount()
equivalent to execute logic similar to:
useEffect(() => {
if (condition) {
// do stuff
}
}, []);
The issue with the above is that the component renders for a split second before executing the useEffect
block of code.
Any way to get around this? Without having the useEffect run in the main App
component or creating a custom hook?