DEV Community

Discussion on: React: class components vs function components

Collapse
 
gilfewster profile image
Gil Fewster • Edited

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.

Collapse
 
colocodes profile image
Damian Demasi

Spot on!