News for hackers. Stuff that matters.
Re:I fell in love with low-JS by antihero on Wednesday May 04, 2022 @06:03PM (#31266439)
Other than being owned by Facebook, I’m not sure how exactly React is a monstrosity. I think people downvote vue fans because it seems they can’t help but tirelessly bring it up any time there’s anything any React and a lot of people clearly don’t feel that vue is “better”, so it gets extremely irritating.
Re:I fell in love with low-JS by funstuff007 on Wednesday May 04, 2022 @09:42PM (#31268363)
At this point, though, aren't React and Vue more similar than different?
Re:I fell in love with low-JS by steve_adams_86 on Thursday May 05, 2022 @12:17AM (#31269405)
I set out to figure out the answer to this question by writing about it and comparing various performance issues, ease of composition of components, debugging, etc.

I didn’t find any particularly interesting or meaningful differences.

At the template level, JSX exposes more plain old JavaScript than Vue’s templates do. I find defining and using types in JSX land more intuitive. Otherwise they’re fundamentally both excellent and very capable and neither is doing any one thing glaringly wrong.

I ended up scrapping it because the deeper I went, the less interesting it got. I think it really does come down to ergonomics and preferences

Re:I fell in love with low-JS by gervwyk on Thursday May 05, 2022 @02:37AM (#31270293)
Even boring as it may sound, definitely something I would read, since I known React well but don’t feel like bothering to much with vue atm, but would like to understand the difference / nuances.
Re:I fell in love with low-JS by acemarke on Thursday May 05, 2022 @03:03AM (#31270451)
A few differences between React and Vue, purely off the top of my head. (Caveats: I am deeply involved in the React ecosystem and have never personally _used_ Vue myself, but am generally familiar with it overall.)

Vue: rendering output defined primarily with templates and attributes like `v-for`; Single-File Components structure, lets you define styles as CSS and I _think_ they get scoped automatically; all major libs for routing, state management, etc, are considered "official" Vue packages and have at least some intentional coordination; probably less ecosystem churn overall due to those "official" packages; possibly easier to get started with, since it's easier to drop in one script tag and use it as a small enhancement to an existing page; reactive data UI for updating state (`state.value = 123` auto-triggers UI updates of components that rely on that data).

React: JSX syntax for rendering logic ("It's just JS!"); no official structure for defining component files/folders/logic; React is still "just a rendering lib/framework", so all other capabilities (routing/state management) are filled in with community maintained packages (React Router, Redux, etc); _dozens_ of community packages for any conceivable use case, but plenty of churn as a result; _can_ be used with just a couple script tags, but in practice normally used with a full JS build toolchain; explicit `setState(newValue)` API for triggering re-renders, and renders many components by default - have to intentionally optimize components to avoid unnecessary re-renders.

Re:I fell in love with low-JS by steve_adams_86 on Thursday May 05, 2022 @10:15PM (#31280502)
I might actually revisit it – maybe going a little deeper will eventually point to something interesting. Thanks for the nudge, I’m never sure who will be interested in things and why.
Re:I fell in love with low-JS by mmcnl on Thursday May 05, 2022 @12:42PM (#31275586)
Vue supports JSX as well, and has been doing so for years.
Re:I fell in love with low-JS by steve_adams_86 on Thursday May 05, 2022 @10:13PM (#31280490)
Good point, I didn’t bother taking this route but now that I’m thinking about it, maybe it would have been useful to illustrate differences between features state management.
Re:I fell in love with low-JS by jahnu on Thursday May 05, 2022 @02:40AM (#31270312)
Anyone know of a good quality comparison out there? A video or blog post?
Re:I fell in love with low-JS by jokethrowaway on Thursday May 05, 2022 @08:37AM (#31272552)
Read the code, then go and check preact codebase which achieves the same api.

React is the definition of an overcomplicated codebase + its model is wasteful and re-renders too much by default.

It's the least ergonomic framework which became popular I've ever seen in my entire career.

A pure case of resume driven project getting popular in some FANG and then being shoved down the throat of developers everywhere because cargo culting.

Re:I fell in love with low-JS by progx on Thursday May 05, 2022 @04:27AM (#31270937)
As a svelte user, i shake my head on react and vue.
Re:I fell in love with low-JS by FractalHQ on Thursday May 05, 2022 @02:40PM (#31277006)
It’s baffling to me how something like Svelte can be so much better in nearly every way for developers, businesses, and end users, yet still fly under so many people’s radars!
Re:I fell in love with low-JS by Volrath89 on Friday May 06, 2022 @05:37AM (#31283198)
Is svelte SEO friendly by default? (SSR)
Re:I fell in love with low-JS by FractalHQ on Saturday May 07, 2022 @03:08AM (#31292730)
Yes Sveltekit does SSR by default behind the scenes.
Re:I fell in love with low-JS by Volrath89 on Monday May 09, 2022 @02:38AM (#31311268)
Is Sveltekit to Svelte as Next.js is to React?

Or is it more like create-react-app is to react?