This article right here on Dev.to is pretty handy - so much so that I stuck it in my reading list. A constructor is ultimately a lifecycle method. And in Hooks, there is exactly one lifecycle method - useEffect(). As the name implies, there is no such thing as a useEffect() call that runs before the component renders (since, an "effect" has to happen... after something else). And as the article above implies, useEffect() can actually be used four different ways - although I don't personally believe that any of them are intuitive just by reading the names/arguments.
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.
dev.to/spukas/4-ways-to-useeffect-pf6
This article right here on Dev.to is pretty handy - so much so that I stuck it in my reading list. A constructor is ultimately a lifecycle method. And in Hooks, there is exactly one lifecycle method -
useEffect()
. As the name implies, there is no such thing as auseEffect()
call that runs before the component renders (since, an "effect" has to happen... after something else). And as the article above implies,useEffect()
can actually be used four different ways - although I don't personally believe that any of them are intuitive just by reading the names/arguments.