News for hackers. Stuff that matters.
Re:Solid.js feels like what I always wanted React to be by valtism on Tuesday March 01, 2022 @01:24AM (#30510391)
I've used React for ~3 years, primarily with function components and hooks. I think that hooks were a wonderful addition and I think the framework has made smart choices with checking object equality to decided if components re-render.

That said, I think that easily the most difficult aspects of react revolve around how re-renders are triggered. Maintaining referential equality to stop unnecessary renders gets tricky when you are passing functions or objects. Suddenly you need to be using `useMemo` and `useCallback` and passing dependency lists that all have to be primitive values unless you want to memoize them as well. It can become such a headache that the official line around it mostly seems to be "make the render fast, don't worry about unnecessary re-renders" – good advice, until you hit a use-case where you need to worry.

Solid takes these problems and just vanishes them. UI state knows what its dependencies are automatically and only updates when they change – even in a sub-component level!

To be fair, I've never used Solid in anger, and moving to it would be a big ask when there is such a good ecosystem built up around react. That said it is easily one of the most exciting projects on my radar, and the developer Ryan Carniato seems extremely knowledgeable in the area.

Re:Solid.js feels like what I always wanted React to be by stocknoob on Tuesday March 01, 2022 @01:27AM (#30510410)
For the other Americans, “used xyz in anger” means “used xyz in production”.

https://english.stackexchange.com/questions/30939/is-used-in...

Re:Solid.js feels like what I always wanted React to be by mst on Tuesday March 01, 2022 @12:50PM (#30517368)
Speaking as a british programmer, if a given piece of software hasn't made me yell expletives at the screen at least once, I probably haven't done something sufficiently non-trivial with it to count as "used in production" yet.

But then again even by british standards I am unusually sweary when writing code.

Re:Solid.js feels like what I always wanted React to be by zbentley on Wednesday March 02, 2022 @08:12PM (#30535839)
Nope, you get it. Both you and GP are saying the same thing, I think.
Re:Solid.js feels like what I always wanted React to be by throwamon on Tuesday March 01, 2022 @09:35AM (#30514607)
I always assumed it was something like "I got so angry with a certain solution that I gave in and tried this other one".
Re:Solid.js feels like what I always wanted React to be by marcus_holmes on Tuesday March 01, 2022 @08:19AM (#30513754)
Had to explain "used in anger" to my German gf last week, as her boss had used it and she was confused about why he was angry with her code. It's surprisingly hard to explain the nuances of it.
Re:Solid.js feels like what I always wanted React to be by LAC-Tech on Tuesday March 01, 2022 @05:16AM (#30512218)
Weird. I'm not British by I say "used xyz in anger" because I read lots of other programmers saying it. Had no idea it was regional, thought it was hacker lingo like "grok".
Re:Solid.js feels like what I always wanted React to be by Tade0 on Tuesday March 01, 2022 @05:35AM (#30512377)
I'm not an English native speaker and today I learned that I misinterpreted a lot of what was said to me in the past.
Re:Solid.js feels like what I always wanted React to be by madeofpalk on Tuesday March 01, 2022 @06:32AM (#30512858)
Australian living in England as a dev for 5 years. Never heard of "used in anger" in any context. Weird.
Re:Solid.js feels like what I always wanted React to be by josephg on Tuesday March 01, 2022 @09:10AM (#30514321)
Australian living in Australia for most of my life. I've heard "used in anger" lots of times. I can't remember when, or by whom. But its certainly a thing I've heard people say here.
Re:Solid.js feels like what I always wanted React to be by branko_d on Tuesday March 01, 2022 @07:48AM (#30513439)
Serbian living in Kazakhstan as a dad for the last 4 years. Heard it plenty of times before, but never in the context of computer programming. Weird. :)
Re:Solid.js feels like what I always wanted React to be by depressedpanda on Wednesday March 02, 2022 @04:05PM (#30533145)
> thought it was hacker lingo like "grok".

How is grok considered hacker lingo? I would think other people than hackers have read Stranger in a Strange Land.

Re:Solid.js feels like what I always wanted React to be by lgvld on Tuesday March 01, 2022 @04:57AM (#30512054)
Thank you! ;-)
Re:Solid.js feels like what I always wanted React to be by brundolf on Tuesday March 01, 2022 @02:08AM (#30510664)
> Solid takes these problems and just vanishes them. UI state knows what its dependencies are automatically and only updates when they change – even in a sub-component level!

I haven't looked at Solid but I've used MobX extensively, and this sounds a whole lot like it. It integrates well with React, so you might give it a look if you've got an existing React codebase.

Re:Solid.js feels like what I always wanted React to be by branko_d on Tuesday March 01, 2022 @07:51AM (#30513471)
I second that! MobX + React is a good way to scale your codebase, not just performance-wise, but understanding-wise as well!
Re:Solid.js feels like what I always wanted React to be by emerongi on Tuesday March 01, 2022 @02:05AM (#30510633)
Agreed, after 6 years of use, my gripes with React come down to the re-rendering and lack of syntactic sugar for commonly used things. Hooks can get messy, but complicated components were complicated even with the class syntax.

What React has going for it, is that it is predictable. That is an extremely important part of any tool.

Re:Solid.js feels like what I always wanted React to be by tempouser23 on Tuesday March 01, 2022 @02:28AM (#30510790)
"UI state knows what its dependencies are automatically and only updates when they change" - you should check out [valtio](https://github.com/pmndrs/valtio).
Re:Solid.js feels like what I always wanted React to be by ryansolid on Tuesday March 01, 2022 @02:41AM (#30510881)
There are a lot of React state libraries that do similar things with Proxies. I think the part that is not as emphasized is how that reactivity extends to the view. Instead of re-rendering components it uses that knowledge to directly update portions of the DOM. So while MobX, Valtio, Jotai, Recoil etc localize change in React, they still feed into the whole VDOM React cycle, instead of just updating exactly what changes. It's not a characteristic of these libraries but the fact they feed into React.
Re:Solid.js feels like what I always wanted React to be by mst on Tuesday March 01, 2022 @12:56PM (#30517451)
Solid very much seems like "what would happen if somebody took the way I usually combine react + mobx and built something designed for that from the ground up".

The only thing it doesn't obviously do better is the JSON Patch generation stuff that I get from mobx-state-tree and I use the word obviously because it would not at all to surprise me to discover that solid already does that and I simply didn't RTFM hard enough yet.

The sheer level of ecosystem (and the "nobody ever got fired for" advantage that results) may keep me using react but solid is a bloody impressive piece of kit and whether I ever end up using it myself or not, "bravo, sir" applies.

Re:Solid.js feels like what I always wanted React to be by tempouser23 on Tuesday March 01, 2022 @03:03AM (#30511038)
Though you can use smaller components to minimize the changes. Valtio i feel is one of the simplest of those. But yes they are no way compared to solidjs. Of the numerous frameworks in recent years solidjs has the only which has interested me to pick up and use it. Though still not in production.
Re:Solid.js feels like what I always wanted React to be by bayesian_horse on Tuesday March 01, 2022 @08:02AM (#30513567)
Use `reselect`!