The equivalent in functional components is the useEffect hook, which can be setup to run a function when one or more specific dependencies change.
There is also a hook called useReducer which gives you the ability to perform complex actions and logic when dependencies change. Very useful for deriving properties from complex state.
the only thing I like Class Component is that there is a
callback in setState
. I usually use it when after set loading for the page :)The equivalent in functional components is the useEffect hook, which can be setup to run a function when one or more specific dependencies change.
There is also a hook called useReducer which gives you the ability to perform complex actions and logic when dependencies change. Very useful for deriving properties from complex state.
Spot on!