5 ms·
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 smar
by valtism 5y ago
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.
- stocknoob 5y agoFor the other Americans, “used xyz in anger” means “used xyz in production”. https://english.stackexchange.com/questions/30939/is-used-in-anger-a-britishism-for-something https://english.stackexchange.com/questions/30939/is-used-in...
- lgvld 5y agoThank you! ;-)
- LAC-Tech 5y agoWeird. 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".
- madeofpalk 5y agoAustralian living in England as a dev for 5 years. Never heard of "used in anger" in any context. Weird.
- branko_d 5y agoSerbian 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. :)
- josephg 5y agoAustralian 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.
- Tade0 5y agoI'm not an English native speaker and today I learned that I misinterpreted a lot of what was said to me in the past.
- depressedpanda 5y ago> 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.
- marcus_holmes 5y agoHad 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.
- throwamon 5y agoI always assumed it was something like "I got so angry with a certain solution that I gave in and tried this other one".
- mst 5y agoSpeaking 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.
- zbentley 5y agoNope, you get it. Both you and GP are saying the same thing, I think.
- emerongi 5y agoAgreed, 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.
- brundolf 5y ago> 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.
- branko_d 5y agoI second that! MobX + React is a good way to scale your codebase, not just performance-wise, but understanding-wise as well!
- tempouser23 5y ago"UI state knows what its dependencies are automatically and only updates when they change" - you should check out [valtio](https://github.com/pmndrs/valtio https://github.com/pmndrs/valtio).
- ryansolid 5y agoThere 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.
- tempouser23 5y agoThough 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.
- mst 5y agoSolid 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.
- bayesian_horse 5y agoUse `reselect`!
- deleted 5y ago[deleted]