4 ms·
/me gestures emphatically at the entire "HTML & CSS in JS" paradigm. When you elevate JS above the others, you deprioritize those others in practice. Advanced
by ttfkam 3y ago
/me gestures emphatically at the entire "HTML & CSS in JS" paradigm.
When you elevate JS above the others, you deprioritize those others in practice. Advanced knowledge of HTML among React developers is a surprisingly rare talent. Whereas Node developers gobbled up (and choked on) left-pad due to incomplete knowledge of JS, far too many (a majority of?) web framework developers reach for packaged components without realizing it was a standard tag with two lines of CSS away.
Accordion: <detail> + <summary>
Button (as a link): <a href> with inline-block, background-color, and other basic CSS
Card: <article> with border-radius and box-shadow
…pretty sure I could do most of the English alphabet in examples.
JS could be used for progressive enhancement—animating the accordion, for example—but almost all accordions I've seen were the typical spaghetti of div tags, chunky event handlers, and accessibility lipstick of aria-roles. But most React devs see some library's Accordion object and think it's normal to see the dark <div> forest in the inspector.
- nosefurhairdo 3y agoGotcha; JSX, by colocating related JS and HTML, tempts inexperienced developers to write JS hacks for behaviors already available natively in HTML and CSS. I think that is a fine tradeoff when the alternative is an arbitrary separation of technologies, a web of querySelectors, imperative DOM manipulation, and walls of incoherent stylesheets.
- ttfkam 3y agoFalse dilemma. Try Svelte.
- eternityforest 3y agoVue and similar don't have this issue. When used in the most basic way it's just HTML with templating commands. What you see in the inspect window is what you typed, maybe duplicated with a for, or removed with an if.
- ttfkam 3y agoI agree that Vue is much better than React in this regard. Svelte and HTMx are both steps up from Vue in my opinion.
- jakubmazanec 3y agoIt's never about a framework, it's always about the programmer. Hacker news is full of complaints about (React) frameworks and how they are the worst and using them makes your web the worst, but in reality almost nobody makes the effort to make the best possible one. It's simply not the frameworks' fault. Current JS framework from adding the 'autofocus' attribute to your inputs.