|
|
|
|
|
by Spivak
1373 days ago
|
|
> have restrictions on where to be called This is because hooks are just next() calls on an iterator. Is it magic and entirely because the devs thought it was more beautiful than having to pass a key like state = useState("state", 0)? Absolutely. Does it transcend JS, no. hooks = [1, 2, 3, 4]
isOne = next(hooks)
isTwo = next(hooks)
if flipcoin()
isThree = next(hooks)
# oops, it's sometimes 3
isFour = next(hooks)
|
|