Hacker News new | past | comments | ask | show | jobs | submit login

I don't understand why we're still stuck with hooks. JSX was a syntax change introduced to support things that were hard to express with existing JavaScript syntax, why not do the same instead of hooks? Using function-call notation to create hooks seems like a kludge, and if you are going to process your source with an transpiler and add browser-incompatible syntax like JSX, why not do hooks the same way?

This would allow us to avoid all the gotchas with non-pure functions in useEffect, breakage when calling hooks in conditions or loops (hoist them!), and whatever restrictions might come next.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: