Earlier quoted context omitted.
Not to mention terms that do come from a general programming paradigm, but have a very narrow practical / framework-specific use within frontend dev that makes it even harder for beginners (e.g. "thunk" might be a general term, but I bet most people googling it are just trying to get some Redux tutorial to work, and will end up going down dozens of rabbit holes trying to understand the general concept) I really hate…
React's hooks (and some JSX style things in general) are quite pernicious there because they essentially break JS: you can't use them inside an `if` or a `for` or a `while`, or even within another function. You're no longer writing Javascript, you're writing a restricted subset to avoid undefined behaviour. That alone is a concern, because any junior programmer getting an introduction through React is going to get a…
Comparing Svelte and React
261–270 of 338 posts
Re: Comparing Svelte and React
#262Earlier quoted context omitted.
There’s svelte-testing-library [0] which follows the same approach as the React flavor. It emphasizes testing the app “as the user would use it”, which boils down to rendering components and inspecting the DOM. They intentionally don’t give you visibility into the internal state of the component, which can be weird to get used to if you’re used to doing things like “click the button; assert that state isClicked becam…
Thanks, that looks pretty good, and testing-library is excellent. I couldn't find it in the docs, but do you know how this "renders" the Svelte components - in memory using e.g. jsdom, or by firing up a full-fledged browser? (The former would be highly preferable.)
For end-to-end tests with a real browser, Cypress is a good option.
Re: Comparing Svelte and React
#263Earlier quoted context omitted.
React, Redux, Jest, and it’s ilk always came off to me as a way for Facebook to remain relevant through tech-debt and lock-in.
FWIW, Redux has _never_ been a Facebook project. Yes, both of the creators now work on the React team (Dan Abramov and Andrew Clark), but it's always been an independent OSS project, and is currently maintained by myself and Tim Dorr. As far as I know, FB barely even uses Redux at all internally, and that only in isolated particular teams that chose it themselves. My understanding is that they mostly use Relay for th…
My commentary is more directed at React and Jest (as I try to steer away from that ecosystem, even though it's ideas aren't all bad):
- As GP indicates, React has had multiple API implementations to solve similar problems, feature bloat, leading to opinionated and differing best practices, mixed in with Junior devs can be a nightmare
- With Jest, I find the entire thing as a very aggressive wrapper and very tied to React itself, features like unit test `snapshots` are developer slack-off bait and have the benefit of further entrenching itself into the repository, arguably an e2e test would validate the same thing
Re: Comparing Svelte and React
#264Earlier quoted context omitted.
React, Redux, Jest, and it’s ilk always came off to me as a way for Facebook to remain relevant through tech-debt and lock-in.
Doesn't make sense, there is nothing that benefits facebook by "dominating" a tech niche. They dont profit off of development platforms (android and .NET) like google and microsoft
Re: Comparing Svelte and React
#265Re: Comparing Svelte and React
#266Earlier quoted context omitted.
Novel - not, in my opinion. How to do GUI is known from 1970-ties. Today's single page apolication frameworks slowly re-discover the wheel. It is funny to observe.
The very important difference is that we do distributed systems now (admitted, X originally was also distributed, but only the drawing/events parts, not on the data level). A SPA is a distributed system, with all its drawbacks & pitfalls. If you ever did VB development in the 90s, you will know how easy it was to get a basic app running with those fancy Drag'n'Drop RAD tools. But there was no networking, everything w…
Re: Comparing Svelte and React
#267I'm a big fan of Svelte. I've raved about their documentation before, but it bears repeating: this should be the gold standard. You can read it all in a day. There are examples to follow right next to the documentation. Svelte is both succinct and powerful. I find this in contrast to React which is often baffling and incoherent. I say this as someone that has used React professionally for 6 years. They've changed the…
IMO, Svelte’s biggest issue is it didn’t come out of FAANG.
Re: Comparing Svelte and React
#268Earlier quoted context omitted.
They are the same. It's a matter of style. For that matter, you could also write: onMount(listenForAuthChanges) which is technically simpler -- you're not constructing a new anonymous function. But if you wanted to extend the code (to say, add a console.log), you'd need to do the top version, which already has the braces. It's up to your judgment of what's clearer and likely to be more maintainable.
That should work in the provided example, but in general `fn(cb)` is different: you lose the implied `this` binding unless you do `cb.bind(something)` beforehand. There's also some unexpected trouble due to potential extra parameters. Consider the output of ['1', '2', '3'].map(parseInt) gives: [1, NaN, NaN] So yea, fn(() => cb()) is the same as fn(() => {return cb()}) – just syntactic sugar when the anonymous functio…
Re: Comparing Svelte and React
#269I wrote my first decent size Svelte app (with a Rails API app backend) last year: https://www.listenaddict.com/ Of course, what you see is just a tip of the iceberg, having implemented a nice admin and moderator dashboard, keyboard shortcuts, animations, 12 different color themes (in light and dark mode), and more. Svelte just made it all so easy to do. Having done a good bit of React and Angular professionally, and…
Re: Comparing Svelte and React
#270Earlier quoted context omitted.
We specifically recommend using our official Redux Toolkit package, rather than `typesafe-actions`. RTK is already written in TS and designed for a solid TS usage experience: https://redux-toolkit.js.org
Redux Toolkit is great and removes most of the usual Redux boilerplate which seems to be the most often used argument against Redux. Additionally, I usually use a function which uses createEntityAdapter, createSlice and createAsyncThunk methods to create Ducks bundles for each REST API resource automatically. As a result I get all async action creators, reducers and basic selectors for some REST API resource with a c…
https://rtk-query-docs.netlify.app
We're working on finalizing that API and will be merging the functionality and docs back into RTK itself for an upcoming RTK release: