Live data from Hacker News

Rich Harris joins Vercel to work on Svelte full time

twitter.com

361–370 of 571 posts

Re: Rich Harris joins Vercel to work on Svelte full time

#361

I'm tired of having to learn yet another templating language without a very compelling reason. Why do I have to learn, what is essentially, a new programming language for each of these frameworks (Angular, Svelte, Vue, React... Do I really need to learn yet another language construct for stuff like `loops`, `if/else`, event handlers...etc. Why must all of these frameworks re-invent the wheel? At least with React it i…

I don’t love that aspect myself, but I have to point out that in Svelte’s case it is definitely not “without a very compelling reason”. The special build-time processing is the entire point of Svelte. Though personally I’d almost prefer it was a whole new language than a “kind of JS but with some (necessarily) new syntax”

[deleted]

Re: Rich Harris joins Vercel to work on Svelte full time

#362

Earlier quoted context omitted.

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.

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.

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

#363
post #329

Earlier quoted context omitted.

What how can you say that??? {myItems.map({id, title}) => {title} } vs... svelte {#each myItems as item} {item.title} {/each} One is literally just javascript and html the other is an entirely different template language. You might say... JSX is not HTML... well it's very very similar... If you know HTML you JSX is very intuitive.

> literally just javascript Repeating it over and over again does not make it true. https://linkedlist.ch/jsx_is_not_just_javascript_39/

Repeating a blog post over and over doesn't make it true.

The author is wrong. Most of his statements are about React, not JSX.

It's syntactical sugar for nested function calls, that's all. Brackets are turned into function statements, attributes are turned into object props.

The author conflates React properties with JSX, which is wrong. The author also confused JSX limitations, you cannot do statements because it's a single expression.

Please go read the JSX spec instead of some random blog post.

https://github.com/facebook/jsx

Re: Rich Harris joins Vercel to work on Svelte full time

#365
post #281

Earlier quoted context omitted.

i did try that - https://twitter.com/swyx/status/1294310598419689472 but when the core team is not interested in it there's only so much i want to push it on my own - rather just move to Svelte where the community already gets it

Looks great! Seems to me that there’s just not enough pain around this. Ironically, React being “good enough” at performance (in most cases) probably means that there’s not appetite for squeezing out the last few millimeters (again for the vast majority of use cases — clearly there is some need otherwise svelte wouldn’t exist).

I often ear this "vast majority" claim but is it true? Every slow website I encounter is react or angular based. Maybe I just don't notice the fast ones, but react and fast enough are not really my experience

Re: Rich Harris joins Vercel to work on Svelte full time

#366

I have recently joined a team that had invested in Svelte. I had previous experience in Angular and React. I was happy with React, but I decided to drink the koolaid and go all-in and do my best with Svelte. 6 months later, we're moving to React. It is partly because our Svelte code was messy enough to warrant a rewrite, and partly because we wanted to leverage the React ecosystem in that rewrite. It was also partly…

> Special syntax for reactivity is not javascript

That's because there is no syntax for reactivity in JavaScript, period.

Re: Rich Harris joins Vercel to work on Svelte full time

#367

I have recently joined a team that had invested in Svelte. I had previous experience in Angular and React. I was happy with React, but I decided to drink the koolaid and go all-in and do my best with Svelte. 6 months later, we're moving to React. It is partly because our Svelte code was messy enough to warrant a rewrite, and partly because we wanted to leverage the React ecosystem in that rewrite. It was also partly…

Perhaps a shift in mindset about how to approach using Svelte would help. Svelte is not React, and using React for an extended period really changes how you think about frontend code (structure-wise etc). As a quick example, the Svelte 'ecosystem' is simply the Javascript ecosystem, which existed well before React. You can import any npm module to a Svelte app. Outside of the React-specific packages (which I argue ar…

Redux is not React specific. I assume you could use it with Svelte somehow.

That said, most React components are lightyears ahead of native Javascript components, simply because everyone uses React.

Re: Rich Harris joins Vercel to work on Svelte full time

#368
post #347

Earlier quoted context omitted.

fair criticism I wonder how svelte optimizes for rerendering of long component lists. React uses keys to avoid rerendering the entire list.

I believe you can specify a key in Svelte as well, but perhaps it's used slightly differently than react.

Yeah it's not strictly necessary, but if you are updating the list (adding/removing especially), Svelte can know how to reuse elements properly if they are keyed. You also need keys for animations to work properly.

Re: Rich Harris joins Vercel to work on Svelte full time

#369

Earlier quoted context omitted.

But React isn't just JSX. It's also the entire runtime library, hooks, event handling, forms, state handling, etc. The example you shared is a bit too simple to understand where Svelte shines because it doesn't introduce any of those concerns. By having it's own templating language, Svelte is able to compile the templates to JavaScript in a way that addresses many of those concerns in a way that I think it easier to…

Not to mention it takes reactivity to new heights while adding amazingly little actual syntax. When property changes, the fetch refires, loading appears until the fetch resolves then it displays whatever array someFetch resolved to. I came from Vue and that plus the way Svelte does stores (literally nothing special about them) was a breath of fresh air. {#await someFetch(property)} Loading... {:then data} {#each data…

But what does ‘#await someFetch’ actually do? The thing I like most about react is that it’s just executing plain Javascript most of the time.

Re: Rich Harris joins Vercel to work on Svelte full time

#370

Earlier quoted context omitted.

Hearing about a JS framework "X" that is surely that much more elegant than "Y" feels like it's 2010s again!

At least this time Svelte is a step closer toward the native browser stack rather than yet another abstraction layer.

Why not use the native browser stack? It's pretty good now.
Post reply on HN