20 ms·
Yeah you could do this but this “breaks copy paste” (one of the flaws). We want creating a custom Hook to feel exactly like extracting a function. It should fee
by danabramov 8y ago
Yeah you could do this but this “breaks copy paste” (one of the flaws). We want creating a custom Hook to feel exactly like extracting a function. It should feel easy and you shouldn’t need to mess with maps and symbols.
- k__ 8y agoOkay, DX is an important selling factor, so your approach seems reasonable to me.
- danabramov 8y agoRuntime performance is another one. Map lookups aren’t free, especially if there’s a whole bunch of them happening in every component on every render.
- k__ 8y agoYes, the order restriction buys a lot of things rather cheaply. And while I trust the React teams judgement, I teach people React and they often question the "why".