This is a genuine question: is the main advantage of Solid over React that it's faster?
Solidjs: Simple and performant reactivity for building user interfaces
181–190 of 190 posts
Re: Solidjs: Simple and performant reactivity for building user interfaces
#182Portions of the react community are excited about how it's starting to feel more like PHP with the movement towards server actions in "client" code etc I personally don't like that direction so looking forward to exploring new frameworks. What I've generally liked about React/Next setups is that the code is generally explicit and less magic (I also have gripes with hooks feeling like magic). Things like Vue/Svelte wh…
> I personally don't like that direction so looking forward to exploring new frameworks I personally am becoming dissolutioned with React because of this, as a former strong advocate. Next.js and Remix - or whatever the hell it's called this week - are both over-engineered messes. Yes, I'm aware that I don't have to use them, but they are where the momentum and energy of the community is being spent in recent years.…
Re: Solidjs: Simple and performant reactivity for building user interfaces
#183Earlier quoted context omitted.
JSX is a huge conceptual mistake, IMO. Sure, it gives you expressiveness, flexibility, and templating for "free", but this comes at the expense of the separation of concerns principle, which is a bad tradeoff. HTML is concerned with the content and structure of the page. JS is concerned with behaviour and interactivity. Using JS, or any programming language for that matter, to control how HTML is rendered introduces…
> practically impossible because you need to keep all the layers in mind… > …with the MVC/MVVM approach. Every layer has a specific concern… Do we need to keep all the layers in mind, or not? Separation-of-concerns is not a virtue. It’s a trade off between separation-of-concerns and locality-of-behavior. SoC can be a benefit, if it matches your team structure. But also, any abstraction has a cost of increased cogniti…
With MVC/MVVM? Yes, but not all at once. That is, you focus on one layer at a time. You think about its inputs and outputs, and how it interacts with other layers. Then you follow the data to the next layer, and so on.
With JSX, or any project that disregards SoC, you're forced to think about all layers at once. You have to think about how the JS processes the data, and at the same time how this impacts the content and final rendering.
It would be like if on the backend you would mix business logic and data processing layers, or more accurately, put business logic AND your views inside your database. There are developers who don't mind or even argue for this approach, but most developers would agree that this is an insane way to build applications. Yet on the frontend, for some reason, everyone is fine with this.
To give a concrete example, take a look at this page from the React docs[1]. Ask yourself this: what is the structure of the page at any point in time? Is any component modifying data? What happens if it does? What happens if a component renders a structure that is incompatible with other components?
This is a trivial example, so some of the answers are evident, but in a real-world application these and many other questions are very difficult to answer. Especially by staring at the code during a review. I've found that the only reliable way to review code in a modern frontend framework is to run it locally, see what the behavior and rendering is, and correlate that with the changes. And, of course, since there is usually a complete disregard for UI and E2E testing of any kind, this process is error-prone and regressions are common.
> It’s a trade off between separation-of-concerns and locality-of-behavior.
These are often seen as opposing principles, but it's possible to have both. A single HTML file can contain HTML, JS and CSS. Each section has a single concern, but would you argue that LoB isn't preserved?
> any abstraction has a cost of increased cognitive load
None of these principles or models are abstractions. They're design patterns that suggest a certain way of thinking about and organizing an application that makes reasoning about it and maintenance easier.
> If I have to look at 5 files instead of 1, the 5 files better pay for itself in some way
Again, SoC is not about putting things in different files. It's about a logical separation between different parts of the codebase. Whether that happens in a single file or multiple is up to the team to decide.
Re: Solidjs: Simple and performant reactivity for building user interfaces
#184Yet, it is unpolished. It commandeers not only the `use`, but also the `create` prefix for no apparent reason. (We understand it works differently from React, but still... this just adds friction when porting.)
The community is unhelpful. Questions go unanswered. The docs are lacking. Dev tools are alpha / unusable. Every update happens in sync, so you get odd errors that React devs are not familiar with. Some parts of the API must be avoided, but you have to learn this the hard way: Suspense (don't ever introduce this and you'll be fine), createUniqueId (not very unique, not configurable), SolidStart routing (occasionally very slow, no workaround, no support).
Expect rough edges. Not a good fit for all teams. For a small team of experienced devs it can be a great DX improvement though.
Re: Solidjs: Simple and performant reactivity for building user interfaces
#185Earlier quoted context omitted.
That is really interesting, thanks for sharing. Sounds almost too good to be true. I saw however an open issue [0] about performance problems that seems to indicate that component libraries in Svelte suddenly becomes really slow? Another update. I wondered whether this was really unique to SUID or if other component libraries also have this problem. So I included Park UI and Kobalte (which seem to be the only other m…
Yeah it is an interesting one. There is definitely a slowdown due to the amount of wrapping that happens. These sort of libraries tend to put component in component in component etc.. so there is a lot of prop iteration, Object.keys calls in Object.keys calls etc which when used with proxies can add up a bit. The tricky part is no one actually knows how slow these libraries are in say React. My suspicion they are slo…
React doesn't win speed races, but the mentioned slow-downs are rather extreme and would be noticeable.
I agree that one should benchmark against React-MUI as the baseline. In fact, that would give Solidjs a meaningful (less synthetic) benchmark, as in this case we have a wide range of non-trivial one-for-one components to compare with. A goldmine for performance testing.
If SolidJS could outperform React in these kind of workloads you would have a great proposition.
Re: Solidjs: Simple and performant reactivity for building user interfaces
#186Earlier quoted context omitted.
I've been using solidjs (via solidstart) for awhile on a medium sized project. > Portions of the react community are excited about how it's starting to feel more like PHP with the movement towards server actions in "client" code etc Solidstart definitely pushes you to use their magic server functions. I used them at first - but increasingly I've been moving back to writing a normal, real REST interface on the server…
Thanks for the answer. And http caching is definitely a huge factor for me too, graphql gives me similar sorts of pain. Sure, you can cache anything if you hack around for long enough, but in a real world engineering org (not the unicorns or uniquely positioned tech giants), it's so much easier for me to tell the CEO I can put some cache headers in by end of day and move on.
To be clear, solidstart also makes it very easy to set up a REST API server endpoints. They're ~10 more lines of code compared to their magic RPC handlers. They work great.
https://docs.solidjs.com/solid-start/building-your-applicati...
Re: Solidjs: Simple and performant reactivity for building user interfaces
#187Genuine question: Why would you use Solid instead of Svelte? I'm coming from React and most alternatives seem quite similar to me. Only Svelte does things very differently with its compiler. Vue and Solid just seem to be a different flavour of React.
They are pretty close in mindset (how state works), but Svelte is more established, better polished, has better docs, with a larger community, and of course, great animation / transition support. Svelte 5 does not have dev tools at the time of this writing, just like Solid. SFC is great, Solid has no comparable offering. It also has robust error handling, better than Solid.
That said, Solid has a way better Tanstack Query implementation. (No idea why we still don't have a proper Svelte 5 version today.) It is reasonably close to React that you may feel it should be easy to switch – though that is deceptive. Most of the work is not in the templates but in how the state works, and for this reason it is easier to port Solid code to Svelte or Vue than to React. Developing in Solid is smoother, because it is not a custom template, but just TypeScript. Less concepts to learn, if you are well versed in React.
Both can be good choices for different use cases. And then sometimes React is the right choice.
Re: Solidjs: Simple and performant reactivity for building user interfaces
#188Portions of the react community are excited about how it's starting to feel more like PHP with the movement towards server actions in "client" code etc I personally don't like that direction so looking forward to exploring new frameworks. What I've generally liked about React/Next setups is that the code is generally explicit and less magic (I also have gripes with hooks feeling like magic). Things like Vue/Svelte wh…
Never did I ever once think React would one day be compared to PHP. Reading that post the other day and seeing modern terminology being applied to old backend rendering was quite the experience. "Imagine on initial page load it returns the complete screen UI with all props and components already hydrated". I remember those days but I remember some of the bad as well. I really started to hate that every UI change in t…
HN likes to dunk on React but I think the paradigm is pretty cool and I hope that other meta frameworks beyond NextJS find ways to support it in simpler to follow ways - Tanstack Start has a promising looking philosophy, excited to see where they land on.
Re: Solidjs: Simple and performant reactivity for building user interfaces
#189Earlier quoted context omitted.
I think it's just the lifecycle of craftsman tooling in general. When everyone has experience with a tool, everyone can enumerate its downsides in unison, but we can't do that with new/alternative tools. Whether we confuse that for the new tool having no drawbacks, or we're just tired of dealing with the trade-offs of the old tool, or we're just curious about different solutions, we get a drive to try out new things.…
It's also easy to confuse problems that arise from failing to adequately manage the gotchas with problems inherent in the tool itself . There's a subtle distinction there that's easy to miss, especially for those with a blame-the-system sort of attitude (which I don't entirely fault). One company I worked for had a very slow frontend. It was common there to blame the slowness on React. "React is just kind of slow." A…
Might just be me, but it feels like a good framework/library would put in a lot of work to avoid or at least alert about these kinds of issues so they can’t stay very long without being fixed.
I’ve seen the same in React (even infinite render loops which couldn’t be ignored and had to be fixed) and to a lesser degree with the likes of Vue as well.
I’m not sure what’s missing but having a tool that is easy to use in the wrong way doesn’t inspire confidence.
Re: Solidjs: Simple and performant reactivity for building user interfaces
#190Earlier quoted context omitted.
JSX is a huge conceptual mistake, IMO. Sure, it gives you expressiveness, flexibility, and templating for "free", but this comes at the expense of the separation of concerns principle, which is a bad tradeoff. HTML is concerned with the content and structure of the page. JS is concerned with behaviour and interactivity. Using JS, or any programming language for that matter, to control how HTML is rendered introduces…
Well, I guess personal preference is also a thing. But I would say that the "market" doesn't agree with your thoughts on the matter (and I don't also, but my opinion matters way less). You can write MVVM as an unmaintainable mess also. From my experience as a freelancer, I have had much harder time fixing badly written Angular projects (all versions) than such written in React. It seems that people as a whole tend to…
What is the inherent issue with Angular? Data fetching is done by services, components use them, components' presentation logic is in html/scss files. If a component is particularly simple/low level, it takes data as input which can passed by the higher level component with help of services. I have found this to be very easy to reason about as long as the structure keeps in mind what each bit's role is in the big picture. Separation while keeping logically connected things close e.g. the component and its html/scss are usually kept together.