DEV Community

Discussion on: Whiteboard: React Hooks

Collapse
 
prafulla-codes profile image
Prafulla Raichurkar

Awesome. I was using useEffect() as an alternative to ComponentDidMount and kept wondering why my code keeps running so many times.

Collapse
 
ranaemad profile image
Rana Emad

Glad you found out something new!

Collapse
 
jakeerc profile image
Jakeer • Edited

Did you debuged you dependency array

useEffect(fn,[dep array keep empty for didMount])

Collapse
 
prafulla-codes profile image
Prafulla Raichurkar

I didn't do this that's why it was updating on every state change