sh03 @sh03.dev · Jun 10

Now that React is moving towards having a compiler I wonder if conditional hooks are possible. IIRC the reason the Rules of Hooks™ exist is that conditionally calling hooks break because of different ordering between renders. 🤞

0 likes 3 replies

?

Replies

Joe Savona · Jun 11

bsky.app/profile/en-j... We may explore conditional hooks at some point but not imminently. We weren’t blocked on the compiler to support them, it’s a question of design and footguns.

sh03 · Jun 10

Now the compiler has a chance to give different IDs/keys to each hook at compile time therefore rendering those issues void AFAICS.

Brenelz · Jun 10

I honestly doubt they'd change that. I think it's stricter about the rules with the compiler so it knows how to optimize