2 ms·
Considering that React with function components is popular and their hook mechanism is seemingly weird, should people also learn algebraic effects as the beauti
by tuukkah 4y ago
Considering that React with function components is popular and their hook mechanism is seemingly weird, should people also learn algebraic effects as the beautiful theory behind it?
Also, if React hooks is the way to describe UI components, I think the mechanism behind it should be either formalised as a proper language feature in JS or in some new language used for frontend development. For example, I noticed this teaser bit in the first materials about Verse: "The full Verse language also has a statically-checked effect system, including both mutable references and input/output." https://simon.peytonjones.org/verse-calculus/ https://simon.peytonjones.org/verse-calculus/ Discussed earlier here: https://news.ycombinator.com/item?id=33946933 https://news.ycombinator.com/item?id=33946933
Or is this something that e.g. ClojureScript with Reagent already formalises and we all should study that?
- seer 4y agoWell there's https://crank.js.org https://crank.js.org that uses native js generators where you would you normally put hooks in. Never used it but looked like a very neat idea. I believe Reagent utilises Clojure's native "atom" to accomplish what hooks try to do but with much better language level guarantees. I guess what js needs is an actual proper language level immutable type, and it wouldn't need all the hooks trickery?