News for hackers. Stuff that matters.
Re:Virtual DOM is pure overhead (2018) by adzm on Saturday May 18, 2019 @10:18PM (#19951002)
Note that even jsx is not technically required, and on occasion I've clenched my teeth and written non-jsx react code for some one-off demos.
Re:Virtual DOM is pure overhead (2018) by acemarke on Saturday May 18, 2019 @11:08PM (#19951194)
Jason Miller's `htm` library is a great alternative: nearly-JSX syntax via template strings, with no compilation needed:

https://github.com/developit/htm

Re:Virtual DOM is pure overhead (2018) by thatswrong0 on Saturday May 18, 2019 @11:45PM (#19951304)
I know that in concept not needing compilation is nice because it’s one less thing to have to worry about, but I don’t think I’d want to use JavaScript without any compilation. Just curious what the use case for not doing compilation is?
Re:Virtual DOM is pure overhead (2018) by nemothekid on Sunday May 19, 2019 @12:17AM (#19951401)
>Just curious what the use case for not doing compilation is?

I'll add another one - the code that comes out is the code that goes in. Remember the days of Coffeescript and minimization before sourcemaps?

When most of your work comes from maintaining a codebase being able to effectively debug your code is crucial and hitting an error in production that is only painfully traced back to development will quickly offset any advantage that framework gives you.

Re:Virtual DOM is pure overhead (2018) by galaxyLogic on Sunday May 19, 2019 @03:49AM (#19952049)
I think this is the the big reason to prefer plain old JavaScript. Compilation is ok in Java etc. where you can still debug your Java-code. But with many of these JavaScript frameworks I don't think that is possible, is it?

I would add that "debugger" is not mostly a tool for finding and fixing bugs. It is tool for code-understanding, giving you a "live view" of your code, for READING your (or someone else's) code in the order it executes.

Re:Virtual DOM is pure overhead (2018) by DonHopkins on Sunday May 19, 2019 @06:01AM (#19952466)
>I would add that "debugger" is not mostly a tool for finding and fixing bugs. It is tool for code-understanding, giving you a "live view" of your code, for READING your (or someone else's) code in the order it executes.

Absolutely! I couldn't agree more.

From the discussion about forking sub-processes from the shell:

The compiler/assembler/disassembler/debugger should be built into the shell, just like ITS DDT at the MIT-AI Lab in 1969! ;)

https://en.wikipedia.org/wiki/Incompatible_Timesharing_Syste...

https://dspace.mit.edu/handle/1721.1/6153

https://github.com/PDP-10/its/blob/master/doc/info/ddt.33

https://github.com/PDP-10/its/blob/master/doc/_info_/ddtord....

https://github.com/PDP-10/its/blob/master/doc/debugging.md

Re:Virtual DOM is pure overhead (2018) by guipsp on Sunday May 19, 2019 @05:27AM (#19952375)
>But with many of these JavaScript frameworks I don't think that is possible, is it?

It is, and works pretty much out of the box nowadays

Re:Virtual DOM is pure overhead (2018) by acemarke on Saturday May 18, 2019 @11:56PM (#19951346)
Some folks simply don't want to use a build system, whether it be for experimentation or not wanting to deal with the overhead of tooling.

Others are looking for options that might minimize overall script / JS size (which is a hallmark of Jason Miller, author of both Preact and HTM).

Another might be to make this easier for beginners. For example, the React docs link to an example HTML page that uses the `babel-standalone` build [0] as a way to try out JSX syntax. However, that's a hefty piece of JS, and it's not at all advisable for real use. HTM might be a good alternative to that.

[0] https://reactjs.org/docs/add-react-to-a-website.html#quickly...

Re:Virtual DOM is pure overhead (2018) by revvx on Sunday May 19, 2019 @12:03AM (#19951360)
I think you have answered your own question: it's one less thing to worry about in your stack.

If you're targeting modern evergreen browsers you already have a lot of modern features at your disposal, including ES6 modules, async/await, string interpolation, but we're not using them.

In fact, I'd say that it's way more than "one thing" that you can stop worrying about: you won't need Webpack/Rollup/etc, Babel, NPM/Yarn, Node.js itself, etc.

Re:Virtual DOM is pure overhead (2018) by toastal on Saturday May 18, 2019 @10:57PM (#19951160)
Weird. I feel like clenching my teeth using JSX and a compilation step when a function suffices.