by kayson · 3y ago · 0 comments
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 that it's just one language getting compiled to its subset (with syntactic sugar for dom elements)
I tried SvelteKit 2 weeks ago after working through learn.svelte.dev and it immediately appealed to me.
Starting with one file in a route that holds JS, HTML and CSS was great. Breaking it up into components as I went along was natural. I think TailwindCSS helped here too, because I barely had to do any CSS work and could focus on JS and HTML.
It took me a while to understand the value of stores and where to use them, but then I hit upon a use case (big complicated multiple nested tree of mutable data).
After a few refactorings I had a very nice compact and easy to understand solution - nothing like what I experienced with RR and Angular.
Svelte clicked after like 3 hours.
Also it's more "fun" than React ever was.
there are better libraries out there like zustand or react-query which helps on most of these stuff.
At least for small projects like this, it's perfect. For something larger/complex I'd be a bit more weary.
* Main search (bottom center, not top right) taking over the screen when you click on desktop is terrible ux
* Should support some fuzzy search or misspelling tolerance, e.g. Cuzco for Cusco
* Valencia, Spain gives a 500 error
* No keyboard bindings when searching to navigate up/down between the matching results (e.g. type in 'Valencia' and I expect I can use the down key to choose which of the three results)
In my opinion I feel like React.js was ahead of its time, but now we're seeing some competitors achieve the same (or better results in terms of benchmarks) with simpler approaches.
Keep in mind these are just opinions, and I'm only about a month into React in a massive web application. That said, it took me like a literal day to learn Vue 2 because it was mostly just like native web development anyways.
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.
I personally do use Meteor again these days to have real fullstack stuff easily, which has built-in state management (client-only collections work extremely well for state) when things become more complex than a few useState things. Also SSR "just works" with this, since a useTracker (from meteor) is executed during SSR cycle (as opposed to useEffect API calls), including rehydration with a fast-render package.
This absolutely is crucial for my projects, or else stuff like proper SEO is simply a pain in the ass. I would even pay money for react to have kind of renderToString on the server that simply BLOCKS (or awaits) during SSR so that the initial HTML contains fetched data. The discussion about react server components at this point is just comically absurd for me, as if they really want to make the simple SSR requirement as complex as possible for no reason, other than maybe force users into Nextjs so they can make more business from magically working hosting.
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.
That's really the big thing. I know everyone loves to believe they're masterclass programmers and falling for such traps is beneath them, but after seeing some of these masterclass programmer's react repos... it's very clear why the react docs is filled with many disclaimers and notes (which kudos to the react team for phenomenal docs).
I don't think the same thing apply for any other popular frontend frameworks.
I love Svelte because prototyping a new feature in it is really really trivial, even with keyboard interactions and animation effects.
Svelte isn't a subset of js/html/css, it just uses them. Svelte does support typescript as well.
SolidJS is the one I am really excited about moreso though, since it uses JSX and works even moreso with the DOM.