Earlier quoted context omitted.
> hooks are just iterables and you access them by calling next() In Javascript, "just iterables" can be put in conditional statements, and they don't cause the outer function to be called again. > Also you're just just Ah yes. That "just" again Edit: > just passing a callback function to React and then giving it some pointers to data Thing is, in plain JavaScript if it was a callback function, it could be called anyt…
And you can put hooks in if statements too, but like iterables it won't have the effect you probably want. it = ["hello", "world", "foo", "bar"] shouldbehello = next(it) shouldbeworld = next(it) if sometimes_true_sometimes_false: shouldbefoo = next(it) # if the conditional is false this will be foo, oops. shouldbebar = next(it) Hooks aren't callback functions, they're functions that take callback functions. apparentl…
On "it's iterators actually", I have a response to a sibling comment here: https://news.ycombinator.com/item?id=30799543