Remix.run Logo
gloosx 7 hours ago

Surely they are not normal JavaScript functions, but at least the syntax itself is not turned into a DSL like we see it in Svelte or Vue. That is the main difference.

WickyNilliams 7 hours ago | parent | next [-]

Yeah I get it. I don't think the "Just JavaScript" label can be applied to react anymore. It held in a class-based world. But it's not true post hooks.

I always hated templating languages

> Greenspun's {{rules.length | ordinal}} rule:

> Any sufficiently complicated templating language contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of the host language

But after working with Vue for a 18 months and expecting to hate it, I actually very much enjoyed it. The biggest downside is strictly one component per file.

Edit: in case I've come across as some kind of react hater, I was an early adopter and still use it professionally to this day

sensanaty 7 hours ago | parent [-]

> Any sufficiently complicated templating language contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of the host language

Agreed, and Vue does it right exactly because they don't let you do complex things in the template. You can use ternaries in a pinch, but `computed`s exist so there isn't even a reason to do stuff like that. There's like... 10? directives that you can use and they are extremely obvious as to what they're doing, and the handlebar syntax itself is extremely limited and doesn't let you do any crazy stuff with it.

WickyNilliams 7 hours ago | parent [-]

Yeah I was surprised, how little I felt hampered by its templating language. With things like handlebars and Jinja you often hit a wall like "how the hell do I express this in this language?", but never experienced it with vue.

Aside: I wish other frameworks would steal Vue's event modifiers. Doing things like `@click.prevent` or `@keyup.prevent.down` is so nice

hasanhaja 7 hours ago | parent | prev | next [-]

Syntactical preferences are subjective though and are prone to familiarity bias. I started my webdev career with React so I'm really familiar with JSX and like it, but that alone isn't enough to make engineering decisions.

I think semantics could be a more objective way to assess the DX of frameworks because you can have/add a syntactic layer on top that suits your preferences [1]. Semantics would be things like rules of hooks, footguns of `useEffect`, component level reactivity rather than fine-grained reactivity, etc. The high level outcome of this would be being able to answer the following question:

"How likely is it that this framework will put me in the pit of success with minimal overhead?"

[1] https://vuejs.org/guide/extras/render-function.html#jsx-tsx

thedelanyo 6 hours ago | parent | prev | next [-]

I can create a .svelte file and I can just write only just hmtl - prolly a block of texts within a p tag.

With jsx, I don't think it's possible - I need to return it.

So even if Svelte is a DSL, to me it feels closer to web standard and jsx

baxuz 6 hours ago | parent | prev [-]

Which is arguably worse, because syntax comes with expectations. The way React (and JSX by extension) works is effectively a bunch of overloaded macros, that depends on the pragma used.

And god help you if you want to mix component level code inside React-land and "vanilla". They had to add 3 new hooks over the last 5 years to try and alleviate those issues, all while gaslighting the community and tool authors that the were "holding it wrong".

SolidJS is far better when it comes to how well it follows expectations, and how well it integrates.