Live data from Hacker News

Why Svelte is our choice for a large web project

github.com

81–90 of 136 posts

Re: Why Svelte is our choice for a large web project

#81
post #69

I dislike the templating pseudo language of Svelte (and many view frameworks). Maybe I am spoiled by react but I never ever want to write my view logic in anything else than JS. This is my main blocker for Svelte.

I've never fully understood this viewpoint, which comes up a lot in relation to React and JSX specifically.

The templating in Svelte and Vue is (almost) html with some magic sprinkled here and there, so much closer to the end result. Using JS for everything is moving further away from the metal.

What is it about writing views the React way that appeals to you more?

Re: Why Svelte is our choice for a large web project

#82
post #69

I dislike the templating pseudo language of Svelte (and many view frameworks). Maybe I am spoiled by react but I never ever want to write my view logic in anything else than JS. This is my main blocker for Svelte.

I've never fully understood this viewpoint, which comes up a lot in relation to React and JSX specifically. The templating in Svelte and Vue is (almost) html with some magic sprinkled here and there, so much closer to the end result. Using JS for everything is moving further away from the metal. What is it about writing views the React way that appeals to you more?

I don’t really feel the same way as GP, but not having static typing (Flow/Typescript) would be a big drawback for me. I would be ok with these pseudo-langs if type checking is still possible.

In the past I used one of Rich Harris’s precious projects (Ractive). I liked it a lot, but since then I’ve written typed JS for a couple years now and I wouldn’t give that up when working on anything substantial.

Re: Why Svelte is our choice for a large web project

#83

Author here, just wanted to make a note. This isn't written to hype a battle in the holy war. Frontend frameworks are a positive sum game! Svelte has no monopoly on the compiler paradigm either. Just like I think React is worth learning for the mental model it imparts, where UI is a (pure) function of state, I think the frontend framework-as-compiler paradigm is worth understanding. We're going to see a lot more of i…

Thanks for your work. I watched a few presentations this week and read quite a bit. It looks very promising, and I'd be happy to start migrating my components to Svelte step by step. I'm a Rails dev, and there's a Rails integration through webpacker already. What I'm waiting for is TypeScript support. Once that's officially released, you can count one covert more :).

Re: Why Svelte is our choice for a large web project

#84
post #60

I love svelte on the personal/toy projects I've tried it on, but does someone have an example of a large-ish svelte codebase with an example of a testing pattern that they've found works? Using mithril/vue/react, there are assertions you can make about how a given action will modify the state, and given some state, how that state will be rendered. I've not found a good way to make assertions on the behavior of code w…

Have you seen this treatise on Svelte testing? (Click the Table of Contents to switch pages)

https://dev.to/d_ir/introduction-4cep

Re: Why Svelte is our choice for a large web project

#85
post #24

I love React and I love Svelte. There, I said it. These are the complaints that standout for me with Svelte after using it for a few months: * Sub-par editor support. For me, the litmus test is whether I can use F2 to rename a variable, and it often does not work inside a Svelte template. There are other places where the editor does not know what to do with your code, because it is not pure JS. Vue is much worse with…

Since you've been using Svelte for a few months after using React, haven't you been hit by the lack of composability in Svelte?

Passing around components as variables is such a common pattern in React, and there's no good replacement in Svelte. The lack of dynamism in components and styles makes theming and crafting reusable components (outside of simple widgets) very tedious [1][2]. I'm genuinely curious how someone can come from React and not be bothered by it.

[1]: https://github.com/sveltejs/svelte/issues/2106

[2]: https://github.com/sveltejs/svelte/issues/1550

Re: Why Svelte is our choice for a large web project

#86
post #68

Slightly offtopic: Why a git repo for a blog post? I guess there are some pro's: public history, PR's , but a blog has comments directly under the article for example. Forking is not expected. Ah well, extensive information anyway, good work :)

some people have been using the Issues tab to create blogs (as it allows comments)

Re: Why Svelte is our choice for a large web project

#88

Earlier quoted context omitted.

I can't believe people use redux in any capacity but here we are.

Do you mind expanding on that? I was thinking the same thing at first, why have this monstrous global state which is against every good practice you have ever heard of. But then, if you want to keep state when switching between pages, you need to hoist up that state to the parent component. At some point, there's going to be a component near the root that keeps a lot of state for its children, that then has to be tri…

There's plenty of reasons to use Redux, even with the additional variety of (good!) options in the ecosystem.

You might want to watch my talk on "The State of Redux" from Reactathon 2019, where I covered some of this:

https://blog.isquaredsoftware.com/2019/03/presentation-state...

Also, note that we have a new Redux Toolkit package, which is intended to simplify many common Redux use cases, and is now our recommended approach for writing Redux logic:

https://redux-toolkit.js.org

Re: Why Svelte is our choice for a large web project

#89
post #84
post #60

I love svelte on the personal/toy projects I've tried it on, but does someone have an example of a large-ish svelte codebase with an example of a testing pattern that they've found works? Using mithril/vue/react, there are assertions you can make about how a given action will modify the state, and given some state, how that state will be rendered. I've not found a good way to make assertions on the behavior of code w…

Have you seen this treatise on Svelte testing? (Click the Table of Contents to switch pages) https://dev.to/d_ir/introduction-4cep

I have not! Thank you!

Re: Why Svelte is our choice for a large web project

#90
post #85
post #24

I love React and I love Svelte. There, I said it. These are the complaints that standout for me with Svelte after using it for a few months: * Sub-par editor support. For me, the litmus test is whether I can use F2 to rename a variable, and it often does not work inside a Svelte template. There are other places where the editor does not know what to do with your code, because it is not pure JS. Vue is much worse with…

Since you've been using Svelte for a few months after using React, haven't you been hit by the lack of composability in Svelte? Passing around components as variables is such a common pattern in React, and there's no good replacement in Svelte. The lack of dynamism in components and styles makes theming and crafting reusable components (outside of simple widgets) very tedious [1][2]. I'm genuinely curious how someone…

It's a great point. I'm not bothered by it only because I'm not using react professionally right now and don't use that pattern. Thanks for bringing that important point up.
Post reply on HN