Live data from Hacker News

Svelte 5 Released

npmjs.com

191–200 of 254 posts

Re: Svelte 5 Released

#191
post #162

Earlier quoted context omitted.

> I iteratively move $state() runes out of .svelte files and into .svelte.ts files where I build a more abstract data-oriented structure for my app from a series of mutually linked classes. Then those runes can be re-imported into the .svelte files, or used and updated wherever you need. I don’t know exactly how you do this, but it sounds like you are dangling on the global state of the runes. This is DANGEROUS in Sv…

Could you elaborate on why it's dangerous? Aren't runes just proxies with some variables in them?

Of course! I was very used to SPA, and the convenience of moving a rune/store to an external file meant it could be accessed anywhere (as the post said). With SSR however, if you’re not careful, you can easily leak data: https://github.com/sveltejs/kit/discussions/4339.

Re: Svelte 5 Released

#192

Earlier quoted context omitted.

Russ - can you please explain the rationale for "In person NYC 5 days a week" and that it's non-negotiable? It seems that you're restricting your talent pool in a labor market that prefers remote work. Given that the Svelte talent pool is smaller as-is, this is counter-intuitive.

Presumably because whoever's in charge decided that's how they want to run their business.

How dare they? Oh, no, why wouldn't they think of the labour market?!

Re: Svelte 5 Released

#193
post #15

Where would one even start learning more about front-end development in today's world? Ignoring the dizzying amount of frameworks, how could I become knowledgeable enough to connect my back-end experience to design the "full stack?"

I am an amateur but the reason I love React is because there is so much learning material. Robin Wieruch's The Road To Learn React book started with building a HN reader.

I think Claude/ChatGPT works exceptionally well with React code.

I tried to learn Svelte but React/Tailwind plus a language model is just incredible.

Much React hate I think is the way I view the band Metallica. They were way cooler in my head when they were not as popular.

Re: Svelte 5 Released

#194

I'm curious what users of Svelte think about https://qwik.dev , have many of you been tempted by it? There are a lot of similarities and both are great at keeping file sizes down with a great DX.

I'm not a front end developer; so what I think about this might not be relevant to someone who works on front end every day. To me qwik looks like many other JS frameworks as far as the developer experience goes - it mixes up the HTML output into JS functions. I really like the way that Svelte has a single file that encapsulates the HTML, CSS and JS for a page and it does so as three seperate chunks of the svelte fil…

I agree, that's a really nice feature of Svelte. It can be done in .astro files from https://astro.build/ too but Svelte is the first place I saw it done, like you say, it's very nice to work that way.

Re: Svelte 5 Released

#195

I can wholeheartedly recommend Svelte. As someone who can only do vanilla HTML/CSS/JS, it lets me build projects quickly and efficiently without having to learn something complex like React. Case in point this silly side project made in Svelte over a weekend: https://meoweler.com

> vanilla HTML/CSS/JS ...but that's what Svelte is not . The techniques you adopt won't transfer over to vanilla HTML/CSS/JS without the magic Svelte compiler. These habits will become crutch when Svelte inevitably goes the way of every Javascript frontend framework. > something complex like React React is not that complex, certainly not more so than Svelte. It's hard to wrap your head around some behaviors, but at t…

> It's hard to wrap your head around some behaviors

I've got a React maintenance and development project coming up in a few weeks. I'd love if you'd expand a bit on these points and maybe point to some relevant docs. You could potentially save me days or more of tail chasing. Thanks.

Re: Svelte 5 Released

#196

Earlier quoted context omitted.

> vanilla HTML/CSS/JS ...but that's what Svelte is not . The techniques you adopt won't transfer over to vanilla HTML/CSS/JS without the magic Svelte compiler. These habits will become crutch when Svelte inevitably goes the way of every Javascript frontend framework. > something complex like React React is not that complex, certainly not more so than Svelte. It's hard to wrap your head around some behaviors, but at t…

> As a programmer, I want to spend most of my time programming in a programming language If your work requires you to use a web stack, this attitude will not serve you well in the long run. If you make the effort to learn these technologies, you'll soon find them to be simple and predictable, but admittedly not without some historical baggage. You may even have an easier time with Svelte, since it has everything work…

Having everything ootb is something I enjoyed a lot with Angular as well.

Interestingly, people chose React over Angular, because it gave you the freedom to not use anything.

Re: Svelte 5 Released

#197

When I recently looked at SvelteKit, what confused me the most was the universal load function. If you use "if !browser" with sveltes browser object, the things inside that branch will only run on the server. But because svelte is compiled, these functions get compiled to two different versions, one for the server and one for the client, in which that if statement has been completely compiled out. That in itself isn'…

Why will I use !browser, when I simply move that code into .server endpoint (or file)?

Because then you are doing a different thing than I did there.

The universal load function specifically not only injects the data on the server before serving the page but then also runs on the client once the page is loaded.

In my specific case the client side version hit a different api, hosted in a different region. There are different use cases for this though.

Re: Svelte 5 Released

#198

When I recently looked at SvelteKit, what confused me the most was the universal load function. If you use "if !browser" with sveltes browser object, the things inside that branch will only run on the server. But because svelte is compiled, these functions get compiled to two different versions, one for the server and one for the client, in which that if statement has been completely compiled out. That in itself isn'…

> but it's weird that normal code and control flow influences compilation. In other languages this would be a macro or something that clearly expresses that it's metaprogramming. Similar kind of thing happens in zig during comptime execution.

It's all acceptable if it at least is documented explicitly and correctly. But I do think sveltekits documentation is a bit sparse and doesn't go into detail about such things.

This is what I would call "magic" or implicit behavior. It seems very nice to have that at first but in reality after significant use of something there will come a point at which one wants to fully understand how it works. The magic then needs to be demystified.

Re: Svelte 5 Released

#199

Earlier quoted context omitted.

That the whole industry embraced. Not bad for a piece of trash.

As someone who had to work around the bugs and limitations of IE6 for years in the enterprise, popularity is not a measurement of how good a technology is. The reason React is "embraced" by the industry is that it is widely used, not because it's the best choice. This lowers the risk for companies that can replace its developers with another easily. I'm not saying it's as bad as beeing stuck with a stale IE (yet), bu…

> The reason React is "embraced" by the industry is that it is widely used

That looks like tautology to me. What point are you trying to make with this?

Comparing IE6 and React is _hardly_ a fair comparison. One was a Trojan horse injected by corporate policies and ACLs, while React gets explicitly chosen by teams. And... Yes, there _is_ a reason why nobody gets fired for choosing React: it's not a bad choice! Is Svelte a better choice? Not universally. Unfortunately—like with many things in our field—it comes with trade offs and the answer boils down to "it depends" again.

React has its quirks, but "hating" on a library because it was part of a dumpster fire project doesn't mean the library is bad, just that people using it weren't competent with it (not necessarily incompetent in general).

Vue, Svelte, Leptos, Solid, Elm. I've seen all of them used as dumpster fire fuel, and it was hardly the library's fault.

Re: Svelte 5 Released

#200

Earlier quoted context omitted.

> vanilla HTML/CSS/JS ...but that's what Svelte is not . The techniques you adopt won't transfer over to vanilla HTML/CSS/JS without the magic Svelte compiler. These habits will become crutch when Svelte inevitably goes the way of every Javascript frontend framework. > something complex like React React is not that complex, certainly not more so than Svelte. It's hard to wrap your head around some behaviors, but at t…

> As a programmer, I want to spend most of my time programming in a programming language If your work requires you to use a web stack, this attitude will not serve you well in the long run. If you make the effort to learn these technologies, you'll soon find them to be simple and predictable, but admittedly not without some historical baggage. You may even have an easier time with Svelte, since it has everything work…

> If your work requires you to use a web stack, this attitude will not serve you well in the long run

I disagree. A "web stack" is outdated quickly, but the language remains mostly the same, as does my data. React lets me express most things naturally as forward data transformations, without entangling me too much to peculiar toolchain that will become obsolete and break absolutely everything.

> You may even have an easier time with Svelte, since it has everything working out of the box, unlike React, which requires you to figure out a build toolchain and a separate solution for styling.

Sure, you'll have an easier time making decisions if someone else makes them for you.

Post reply on HN