Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

why does React have "Rules of Hooks?"

107,084 Aufrufe • vor 1 Jahr •via X (Twitter)

11 Kommentare

Profilbild von James Landrum
James Landrumvor 1 Jahr

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.

Profilbild von UserInterface
UserInterfacevor 2 Jahren

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

Profilbild von mox 🐀
mox 🐀vor 1 Jahr

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

Profilbild von Dinesh Katariya.
Dinesh Katariya.vor 1 Jahr

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

Profilbild von Tiger Abrodi
Tiger Abrodivor 1 Jahr

my new fav youtuber i guess 😁🔥

Profilbild von Prasenjit
Prasenjitvor 1 Jahr

That's seriously interesting 💯

Profilbild von Rustcity Рустcитий
Rustcity Рустcитийvor 1 Jahr

Conditionally calling useState with no returns?

Profilbild von Pete Sena
Pete Senavor 1 Jahr

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

Profilbild von from
fromvor 1 Jahr

Wait what

Profilbild von Uvaan Covenden
Uvaan Covendenvor 1 Jahr

I needed this !!

Profilbild von Matt Timmermans
Matt Timmermansvor 1 Jahr

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.

Ähnliche Videos