The fact that useEffect is called after render (return) doesn't mean anything to your Application component, I hope you realise this. Any component update, apart from loading, will update wasLoading value. And then when loading will eventually change, the fact that useEffect is called after render will play cruel joke with you, because your if statement will never fire. Hmm...
...though I guess in this will still work based on the fact that useEffect in custom hook will always be invoked before the one in Application, just in time switching values back. OK
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The fact that
useEffect
is called after render (return) doesn't mean anything to yourApplication
component, I hope you realise this. Any component update, apart fromloading
, will updatewasLoading
value. And then whenloading
will eventually change, the fact thatuseEffect
is called after render will play cruel joke with you, because yourif
statement will never fire. Hmm......though I guess in this will still work based on the fact that
useEffect
in custom hook will always be invoked before the one inApplication
, just in time switching values back. OK