News for hackers. Stuff that matters.
Re:Lessons on Writing JavaScript and React from ClojureScript by prezjordan on Saturday May 08, 2021 @06:52PM (#27091526)
I assumed (4) was the author's frustration that if-statements aren't expressions, and nesting ternaries is rough.
Re:Lessons on Writing JavaScript and React from ClojureScript by axguscbklp on Sunday May 09, 2021 @12:05AM (#27093131)
Yeah, I do not understand where the author is coming from. One could easily write a helper function in JavaScript that does the same thing that the author's Clojure "cond" does. There is no need to use an IIFE if one does not want to.
Re:Lessons on Writing JavaScript and React from ClojureScript by madia_leva on Friday May 14, 2021 @08:22AM (#27153440)
Hmmmm... I wonder how you would avoid the expressions from being evaluated without wrapping then in a function (sorry if it's a lame question, I haven't done any JS in years).

Not that there is anything wrong with lambdas, but it's quite a los of boilerplate for something as simole as a cond.

Re:Lessons on Writing JavaScript and React from ClojureScript by rjerue on Sunday May 09, 2021 @07:28AM (#27095126)
Bingo, IIFEs are and affront to god and nature. Ones in JSX arguably even more so. However, it's really the only way you can colocate all your display code to one part of a function.