News for hackers. Stuff that matters.
Re:Rich Harris joins Vercel to work on Svelte full time by Keats on Thursday November 11, 2021 @11:39AM (#29189949)
> Svelte doesn't support JSX/TSX though =(

You have https://www.solidjs.com/ that does

Re:Rich Harris joins Vercel to work on Svelte full time by gavinray on Thursday November 11, 2021 @11:43AM (#29190008)
Solid is really cool, and I love the posts by it's author describing the journey to performance that is some years old now.

But what is unique about Vue is that it lets you arbitrarily mix ".vue" and ".jsx/.tsx" files in the same project.

So if you need to define say 50 really tiny helper components, like "Button", "Modal", etc. it's great.

I can write one TSX file and do:

   // UtilComponents.tsx
   export function Button() {}
   export function Modal() {}
   export function Icon() {}
And then in my .vue file I can do:

   <script setup lang="ts">
   import { Button, Modal, Icon } from "./UtilComponents"
   // ...
   </script>
This is not a popular approach, almost nobody uses Vue's JSX/TSX and I'm not sure if people even know you can mix and match arbitrarily like this.

But I've been doing this for a long time and it works great for me haha.

Re:Rich Harris joins Vercel to work on Svelte full time by richeyryan on Thursday November 11, 2021 @12:02PM (#29190245)
This is a really cool idea. This has always been my biggest beef with single file components. It never occurred to me that you could do this with Vue. Thanks for the tip
Re:Rich Harris joins Vercel to work on Svelte full time by protonimitate on Thursday November 11, 2021 @12:16PM (#29190406)
Admittedly I haven't followed Svelte super closely, but isn't "no JSX/TSX" kind of a major ideological point? From reading the intro docs, it seems like separation of js/css/html is a selling point. JSX/TSX would contradict that, no?

Just wondering if my read is correct or if there's some other reason it's been left off the table.

Re:Rich Harris joins Vercel to work on Svelte full time by nicoburns on Thursday November 11, 2021 @01:25PM (#29191206)
Nobody truly separates JS from HTML. You either have to put something HTMLish in the JS, or something JSish in the HTML (HTML itself supports this of course).

IMO the HTML-in-JS solutions (i.e. JSX) are superior to the JS-in-HTML solutions (e.g. Angular/Vue Templates) because they put the standardised turing-complete language in the driving seat rather than the propriety, hard to extend template language.

Re:Rich Harris joins Vercel to work on Svelte full time by alserio on Thursday November 11, 2021 @07:26PM (#29194983)
Still, it's way easier to integrate a js library in a svelte component than in a react component. So maybe the two approaches have different tradeoffs and respective advantages
Re:Rich Harris joins Vercel to work on Svelte full time by swyx on Thursday November 11, 2021 @01:34PM (#29191309)
it is. HTML is the first language of the web, not JS - this is why framework agnostic libraries are so much easier to use with Svelte than with React.
Re:Rich Harris joins Vercel to work on Svelte full time by pjungwir on Thursday November 11, 2021 @04:20PM (#29193341)
I've been using Solidjs the last month for a project, and I really like it. Small bundle size, super fast, not much to learn, not too much magic, lots of control. Basically instead of having a vdom the framework is able to track finer-grained reactive sites and update those when the data changes.