Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

why does React have "Rules of Hooks?"

107,084 görüntüleme • 1 yıl önce •via X (Twitter)

11 Yorum

James Landrum profil fotoğrafı
James Landrum1 yıl önce

I had a component I needed to work different based on an attribute (I know this is bad, hear me out) - when one way I needed 2 hooks and when the other way I needed 3. So what did I do? Put a dummy hook and lined them up so that react had no idea. Same hooks, same order, completely different behavior. I’m not proud but also am very proud of such garbage.

UserInterface profil fotoğrafı
UserInterface2 yıl önce

Why Reader-Focused Websites Triumph Over Google's Algorithm Shifts #marketing #seo

mox 🐀 profil fotoğrafı
mox 🐀1 yıl önce

Feels like the user working for the framework and not the other way around

Dinesh Katariya. profil fotoğrafı
Dinesh Katariya.1 yıl önce

Wow 😮, so useState uses linked lists under the hood, i thought I was getting infinite re render error due to setState being called infinitely.

Tiger Abrodi profil fotoğrafı
Tiger Abrodi1 yıl önce

my new fav youtuber i guess 😁🔥

Prasenjit profil fotoğrafı
Prasenjit1 yıl önce

That's seriously interesting 💯

Rustcity Рустcитий profil fotoğrafı
Rustcity Рустcитий1 yıl önce

Conditionally calling useState with no returns?

Pete Sena profil fotoğrafı
Pete Sena1 yıl önce

Photo of me battling rules of hooks on most @nextjs projects. Ps thanks @greensock for your newest hook 👏 recently

from profil fotoğrafı
from1 yıl önce

Wait what

Uvaan Covenden profil fotoğrafı
Uvaan Covenden1 yıl önce

I needed this !!

Matt Timmermans profil fotoğrafı
Matt Timmermans1 yıl önce

It's because each time you use a hook in a rerender, it matches the call to the state you created in the last render. The hook calls are matched up sequentially: call 0 to call 0, call 1 to call 1, etc. This is dangerous, so React devs put in some paranoid guardrails.

Benzer Videolar