正在加载视频...

视频加载失败

⚛️ 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 次观看 • 3 年前 •via X (Twitter)

10 条评论

George Moller 的头像
George Moller3 年前

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 的头像
George Moller2 年前

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 的头像
Oleg | Front-End Architecture3 年前

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

George Moller 的头像
George Moller3 年前

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 的头像
Shripal Soni3 年前

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

George Moller 的头像
George Moller3 年前

Glad you found it useful Shripal!

Vitalii, decaf developer 的头像
Vitalii, decaf developer3 年前

Can you just remove from effect dependencies?

Csaba Kissi 的头像
Csaba Kissi3 年前

Great explanation George.

George Moller 的头像
George Moller3 年前

Thanks Csaba!

Guilherme de Lucas 的头像
Guilherme de Lucas2 年前

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."

相关视频

Reactive Mainnet is Live! After a successful Testnet with well over 4M transactions, 200M origin events processed and dozens of innovative dApps and use cases devised, we've finally reached the day to launch the Reactive Network Mainnet! From day one Reactive Network will support as both origin and destination chains: 1️⃣ Ethereum Mainnet 2️⃣ Avalanche C-Chain 3️⃣ Base Chain 4️⃣ Binance Smart Chain 5️⃣ Polygon PoS With more on the way! REACT Token - However Mainnet wouldn't function without it's most core component the REACT token, which also goes into circulation today and serves multiple purposes within the Reactive Network ecosystem: Gas Fees: Pay for transactions on the network. Event Log Processing: Consumed as fees when executing Reactive Smart Contracts. Token Burn: Fees are burned, fueling the potential for a future deflationary model. Staking: Help to secure the network and earn rewards. Token Portal - Today we're also launching our Token Portal which will allow users to swap their $PRQ for $REACT and vice versa. As Reactive Network is based upon a Proof of Stake consensus mechanism staking will be available from day one, beginning with delegated staking which will also be done via our Token Portal here: Staking Terms - In response to our user feedback we've also adjusted our initial staking term from 6 months to 3 months. See our Staking Guide for full details on staking: More Questions? We've put together an FAQ to address the most common questions users may have:

Reactive Network

47,441 次观看 • 1 年前