News for hackers. Stuff that matters.
Re:Nue: A React/Vue/Vite/Astro Alternative by vekker on Friday September 15, 2023 @06:21AM (#37520881)
React has a lot of opinionated, "magical" boilerplate. useThis, useThat, ... In my experience, Svelte did a much better job and is closer to vanilla html/js, but for some reason it seems to fail to gain significant traction.
Re:Nue: A React/Vue/Vite/Astro Alternative by iainmerrick on Friday September 15, 2023 @06:44AM (#37521052)
I agree -- I don't love Svelte but it feels much closer to just writing plain HTML+JS+CSS than any other fancy JS framework I've tried.

The goals of this project and Svelte seem very similar, so I'd be interested to see a more in-depth comparison.

Re:Nue: A React/Vue/Vite/Astro Alternative by gcau on Friday September 15, 2023 @08:41AM (#37522074)
Hooks are just normal javascript functions though, they're not syntax.
Re:Nue: A React/Vue/Vite/Astro Alternative by iainmerrick on Friday September 15, 2023 @11:39AM (#37524705)
No special syntax but they do have special semantics, as per the "rules of hooks".
Re:Nue: A React/Vue/Vite/Astro Alternative by root_axis on Friday September 15, 2023 @10:59AM (#37524072)
"use" is just a convention for hook function names, react doesn't require or enforce it.
Re:Nue: A React/Vue/Vite/Astro Alternative by iainmerrick on Friday September 15, 2023 @11:36AM (#37524651)
It's "just" a convention, but a strongly encouraged one. The React docs say:

Its name should always start with `use` so that you can tell at a glance that the rules of Hooks apply to it.

And it is required and enforced if you use the ESLint react-hooks plugin (which I'm guessing most large projects do).

Re:Nue: A React/Vue/Vite/Astro Alternative by mike31fr on Friday September 15, 2023 @04:28PM (#37528716)
Re:Nue: A React/Vue/Vite/Astro Alternative by kehrin on Saturday September 16, 2023 @08:26PM (#37540260)
> In my experience, Svelte did a much better job and is closer to vanilla html/js

I just looked at some Svelte examples and it's a mix of magic keywords (on, bind) with magic symbols (: | @) and new, completely unrelated syntax to both JS and HTML (#each, #if, :else). I guess it looks way more idiomatic if you have an IDE that highlights and lints it correctly. React with its few rules of hooks seems way closer to vanilla JS.