Loading video...

Video Failed to Load

Go Home

⚛️ Future React tip ↓ ❌ Omitting useEffect dependencies usually leads to hard-to-find bugs. ✅ Having said that, there are use cases when you need to run an effect only when reactive parts of the useEffect changes ↓ Extract non-reactive parts with useEffectEvent()

78,174 views • 2 years ago •via X (Twitter)

10 Comments

George Moller's profile picture
George Moller2 years ago

I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics just like this one. Check them out ↓

George Moller's profile picture
George Moller2 years ago

I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics just like this one. Check them out ↓

Oleg | Front-End Architecture's profile picture
Oleg | Front-End Architecture2 years ago

The amazing part about it, there is not single word about it in release notes. When did this land ? 🤔

George Moller's profile picture
George Moller2 years ago

It's not part of a stable React release yet, but you can find more info here I find this to be one missing piece for the useEffect hook, hope they release it soon!

Shripal Soni's profile picture
Shripal Soni2 years ago

I didn't know about `useEffectEvent` hook before. Nice tip, George 👍

George Moller's profile picture
George Moller2 years ago

Glad you found it useful Shripal!

Vitalii, decaf developer's profile picture
Vitalii, decaf developer2 years ago

Can you just remove from effect dependencies?

Csaba Kissi's profile picture
Csaba Kissi2 years ago

Great explanation George.

George Moller's profile picture
George Moller2 years ago

Thanks Csaba!

Guilherme de Lucas's profile picture
Guilherme de Lucas2 years ago

Is useEffectEvent already on React? The react documentation says "This section describes an experimental API that has not yet been released in a stable version of React."

Related Videos