Re:React is a fractal of bad design
by pcthrowaway on Wednesday March 08, 2023 @03:34AM
(#35066660)
I actually like JSX a lot, but I'm baffled when people act like the very thin DSL used by svelte is any more unapproachable than JSX, or like JSX is somehow more javascript when it's a mish-mash of extended HTML (don't forget to use key as needed, and className), React components, and JS (expressions only, not statements... and weird-looking ones at that)
[ Parent
| on HN ]
> don't forget to use key as needed, and className
Those are part of React, not JSX itself. Compare Vue's use of JSX, for example, which just uses `class` and `for` instead of `className` and `htmlFor`.
React just went for JS naming of the attributes instead of html naming of the attributes. Reasonable, if annoying, choice.
Re:React is a fractal of bad design
by mattigames on Wednesday March 08, 2023 @08:13PM
(#35077120)
False, for a lot of attributes you have to use the HTML naming of the attributes, so is not consistent, for example to use aria-label you have to write it exactly like that (not ariaLabel as when using JS)
aria-* and data-* apparently are the exception
More on that: https://stackoverflow.com/questions/52398380/why-react-wai-a...
I recoil from svelte and such because when I see someone trying to invent an ad hoc language inside html attributes I get flashbacks to "transcluding" "directives" of Angular 2.
Re:React is a fractal of bad design
by frosted-flakes on Wednesday March 08, 2023 @01:37PM
(#35072947)
JSX is a simple transformation of nested JavaScript functions, but the custom DSLs used by other frameworks is string templating, which is kind of an inversion of how JSX works. JSX also has extremely good support in just about every editor and it supports TypeScript, which is not true of every DSL.