Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Hooks are more magic than I prefer

But they aren't really magic.. I think the rules of hooks makes it pretty easy to guess how hooks might work under the hood. The fact that they need to be called in the same order every time indicates to me that the could, perhaps, be some sort of hidden array attached to each component instance that keeps track of whatever the hook needs. Each hook call increments the hidden index it accesses by one.

It's a bit odd from the perspective of normal Javascript, that's for sure, but we're already pretty far from that because we're working within the React runtime.






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: