4 ms·
I’m always happy to see React alternatives but I’m not convinced HTML and CSS inside JavaScript was a good idea.
by tambourine_man 4y ago
I’m always happy to see React alternatives but I’m not convinced HTML and CSS inside JavaScript was a good idea.
- thunderbong 4y agoThat ship has sailed long ago!
- tambourine_man 4y agoIt has not. I’m right here at land, don’t intend to go and there are dozens of us here :)
- jfengel 4y agoCertainly not in the form of strings, no. That's a nightmare of run-time debugging just to make sure the tags are all closed and you have the correct attributes. Perhaps pair it with a typescript library for composing it. There's nothing sacred about HTML for describing the DOM, but that it what it was created for, and the language the browser will report it.
- antihero 4y agoYeah the second I saw the string block I noped out. JSX works really nicely and I dislike weird template string stuff now. Same with vue.
- tambourine_man 4y agoNo JSX for me either. I want plain HTML, CSS and JavaScript. All scoped within their files and domains.
- antihero 4y agoI’ve found this to be needless indirection. If your components are large enough to warrant this simply break them down.
- tambourine_man 4y agoJust gotta write your CSS carefully. It's not easy, it takes time to learn, but so does the constant juggling that is the React world. At least the first one is faster and won't be out of fashion in 5 years, since it hasn't been in a decade. I also find separation of concerns conceptually more sound and powerful.
- phailhaus 4y agoReact was created in 2013, so it has in fact been "in fashion" for a decade now.
- tambourine_man 4y agoYeah, hopefully that trend is dying and we can get some sanity back.
- phailhaus 4y agoNot at all, React is still a juggernaut and the industry standard. It is really, really good at what it does and other libraries are often riffs on its design philosophy. Even if React itself goes away for some reason, those patterns are here to stay since it has left a permanent mark on the field. These complaints sound a bit like saying "man, compilers are so complicated, hopefully this trend is dying and we can get some sanity back."
- tambourine_man 4y agoIt's an interesting comparison. An optimizing compiler is an incredibly complex beast that makes developer's life almost incalculably better. Most of our stack would be unfeasible to write and maintain in assembly. I'm not at all sold that React remotely qualifies, in fact, I've yet to see any benefits to developers or end users. >it has left a permanent mark on the field It sure has, an indelible stain
- sirsuki 4y agoI tried reactivity once to help me understand the implementation details under the hood. I wrote https://fancy-pants.js.org/ https://fancy-pants.js.org/ for this where I attached mutation to scheduling a render cycle. But it doesn’t address rendering leaving that to the student. Something that really fascinates me is the difference between diffing versus declaration of dynamic content. In React and Vue it is a runtime function to know what changed and how to apply it. In Ember and Svelte it is a compile time calculation based on markers in the template. I guess it comes down to personal preference. I’m quite the fan of a declarative style template that gets converted/compiled to a machine under the hood instead of diffing at runtime.
- friedman23 4y agoThe alternative is a custom DSL for templating which I find much worse. Even CSS has a DSL for conditional and programmatic logic which I only use because of the immense performance benefits it brings.