6 ms·
Svelte is absolute trash. It actively encourages mutability, which is a one way avenue to bugs bugs and more bugs. ie, shit like this is all over the official
by _prototype_ 7y ago
Svelte is absolute trash.
It actively encourages mutability, which is a one way avenue to bugs bugs and more bugs. ie, shit like this is all over the official documentation:
<script>
let mutable = 1;
function f1() {
onMount(() => {
mutable = /* do some complex shit here */
});
}
function f2() {
onMount(() => {
mutable = /* do some complex shit here */
});
}
</script>
<Component onclick={f1}>
<Component2 onclick={f2}>
</Component2>
</Component>
Complete non-deterministic state changes. Absolutely abhorrent stuff. Cannot believe my coworkers and others actually like using this absolute garbage of a framework.
- sergiotapia 7y agoI can't believe people use redux in any capacity but here we are.
- Leherenn 7y agoDo 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 trickled down the component tree. If you don't need to reuse those components in a different setting, then the redux solution feels quite ergonomic. Now, this is coming from an embedded C programmer point of view, and this is my first foray into react/redux, so I'm obviously lacking context. But we're writing a front end for our embedded device, and I have to say I am pleasantly surprised with the experience.
- acemarke 7y agoThere'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-of-redux/ 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 https://redux-toolkit.js.org
- yohannparis 7y agoWhat a civilized way to express your opinion.
- Jasper_ 7y agoWhat's wrong with mutability?
- pier25 7y agoNothing IMO but a lot of folks argue that using immutable state and functional paradigm results in more predictable applications. Not sure if all this immutability talk in the JS community is parroting because "it's what Facebooks does" or what. Maybe it makes sense once you are building really big front end projects but personally I've never had an issue with mutable state in small to medium sized projects (less than 50k LOCs). Although I admit I've never worked on a Facebook-scale kind of project.
- dang 7y agoHey, could you please stop posting in the flamewar style to HN? I'm sure you have a point here, but it gets lost in the inverse-shit-sandwich thing (flames on the outside, point on the inside). If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and taking the spirit of this site more to heart, we'd be grateful. The idea is curious conversation, and you'll be better able to persuade others about mutability that way anyhow.
- derision 7y agoWhat a well thought out and articulate argument!
- rich_harris 7y agoThat code appears nowhere in the documentation. Regardless, you appear to be confused about the meaning of the word 'mutable'.