Live data from Hacker News

Svelte 4

svelte.dev

211–220 of 227 posts

Re: Svelte 4

#211

Super happy Svelte user. Have recently published an iOS + Android app using SvelteKit and blogged about the process for those interested: https://khromov.se/how-i-published-a-gratitude-journaling-ap... I tested the beta version of Svelte 4 on my app and it worked without requiring any changes other than running the migration script. Excellent work from the team!

This was a great blog post! Thank you for sharing your journey.

Re: Svelte 4

#212
post #206
post #204

Earlier quoted context omitted.

Syntax highlighting and code formatting sometime break because Svelte file is single file component format, which mean it has script, markup and style in a single file. It's rather complex to parse it right, especially when you use regexes to do the job like in VS Code. It's just the problem with the VS Code Svelte extension, not the framework itself nor because of Typescript. Also for my case, it happens because I p…

Maybe, but Vue also has SFCs, and I've never once had issues with syntax highlighting or code formatting there.

the distinct difference between Vue and Svelte is html in Vue need to be wrapped in `` tag. There is no such restriction in Svelte SFCs.

Re: Svelte 4

#213

Earlier quoted context omitted.

Did you read the article? Svelte 4 is mostly a maintenance release. It is largely backwards compatible with Svelte 3 code.

"largely"

I count a total of 3 API changes [1].

[1] https://svelte.dev/docs/v4-migration-guide

Re: Svelte 4

#214

Earlier quoted context omitted.

It's the opposite for me. React can be verbose but that's because a lot of it is explicit and has escape hatches. Svelte has magic that works until it doesn't and then you're stuck in Svelte land. It's not "just JS" despite people marketing it as such

I was stuck once by abusing `bind:` and other time with global exit transitions + sveltekit routing, but that's about it. React on the other hand feels like a pot warming up and we're the frogs being boiled alive at this point. You can write some perfectly valid, but naive React code and it's going to have some footguns. We're so used to write idiomatic React code we don't even notice that anymore. You learn to use s…

> You learn to use stable references in callback functions, to be careful using Context, and so on. But the list is not short, and it only grows.

It doesn't though. React adds new features that are optional and everyone goes "Pfft, I'm moving to Vue because they added [blank]" I've got old React projects that still work fine.

There are languages/frameworks that move fast and break things and then there are languages that just move fast. And Javascript itself is also very backwards compatible. You could still just be using class components and Redux and be fine. I have no interest in these server components right now.

Re: Svelte 4

#215
post #60

I'm curious what peoples' experiences have been using modern react vs svelte vs whatever else is popular these days. I used react a while back for a dashboard mockup and was pretty happy with it. Something about svelte being a superset of standard html/js/css that gets compiled bothers me. I realize that the same can be said about typescript/tsx but I feel like in can trust it more... Maybe it's a maturity thing? Or…

I really do like TSX (react + typescript) for the exact things: Functional Components & Hooks - which are basically functional (albeit impure) building blocks for UI things and interactions. Sure, there goes on a lot behind the scenes and so on, but these two things is for me like "perfect" for composing UIs out of reusable building blocks. But I really hate how react does not have a "blessed"/"official" router or st…

> But I really hate how react does not have a "blessed"/"official" router or state management, and a lot of "innovation" in this space simply looks like fashion waves nowadays, often reinventing the wheel, and are getting unpopular again over time.

From an ecosystem view point I think that's really cool! It means that they're not tied to anything and you can pick what works for you. The community, of course, has found its go-to solution anyway, fittingly named "React Router".

The state management situation is more complicated and I think that's even more beautiful, because someone liking Redux can just use it for themselves instead of it being forced on everyone.

Re: Svelte 4

#216
post #109

Earlier quoted context omitted.

How old was the Add-In? Did the tiny lib you used exist back then and did it support the Surface webcam?

The tiny lib was just a wrapper around some Windows API I guess to read shots from the webcam stream. Also, this lib is not specifically designed for surface laptops/tablets, it was generic, I used a Logitech webcam on dev PC and it worked just fine.

I find it funny how you‘ve gotten a few questions about feature parity, rather than how someone could ever use 300MB for just taking a selfie.

Re: Svelte 4

#217
post #40

Earlier quoted context omitted.

But Svelte obviously doesn't play well with TypeScript, and is kind of its own language - you don't need a source for that. Good luck e.g. getting reactive declarations to play well with TS's type narrowing or null analysis.

I couldn't disagree more. Compared to the mess of hooks in React, Svelte is closer to JavaScript in the script portion and closer to normal html in the markup portion. I use vite and TypeScript with each project and never once had a typing issue. Ive built several production apps and consider it far better for my brain than other libraries I tried, and I've been using React since before Redux was mainstream. Svelte i…

> I couldn't disagree more. Compared to the mess of hooks in React, Svelte is closer to JavaScript in the script portion and closer to normal html in the markup portion.

Come now. Only one of React and Svelte needs a custom compiler to run in the browser, and it isn't React...

Re: Svelte 4

#218
post #65
post #40

Earlier quoted context omitted.

But Svelte obviously doesn't play well with TypeScript, and is kind of its own language - you don't need a source for that. Good luck e.g. getting reactive declarations to play well with TS's type narrowing or null analysis.

you clearly don't know what you are talking about. reactive declarations do not change the type of the objects. it just that they can rerun when the dependencies change. sure for the convenience of the users you do not need to type `let vars...` for every new variable declared in the reactive statement, but no one forbid you to write it before hand, or let the language server/plugin do it for you. but Svelte indeed d…

[deleted]

Re: Svelte 4

#219
post #13

Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.

JS frameworks are like coffee, some people like them milky and full of sugar, some people like them like them lean and black, some are obsessed with making the "worlds best coffee" at home every morning, and some drink whatever brown water comes out of a vending machine. We all like our coffee different, just as we all have favourite features and designs of frameworks. There is no correct, or best, framework, only pe…

react is that dirt tasting coffee you get at the diner that everyone loves

Re: Svelte 4

#220
post #19
post #13

Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.

Svelte tries to improve upon the relatively complex/heavyweight runtime of something like React by shifting as much of that complexity to the build step as possible. It also takes a more "batteries-included" approach compared to React by including some opinionated features like state management, animation, transitions and the like. I haven't dug too deeply into Svelte because last I checked it didn't play particularl…

I really wish svelte would just abandon typescript
Post reply on HN