DEV Community

loading...

Discussion on: React's Odd Obsession With Declarative Syntax

Collapse
isaachagoel profile image
Isaac Hagoel

I meant that even though useEffect (like every hook or anything else inside the render function) runs on every render it can be prevented from running its cleanup and effect code over and over again by passing in an explicit dependencies array (it still redundantly compares the dependencies on every render cycle to decide whether it needs to run but that's cheaper).