4 ms·
I can't figure out why anyone chose to use react... I understand the "it's dominant and has a large ecosystem" argument, but I just can't wrap my head around h
by jmull 4y ago
I can't figure out why anyone chose to use react...
I understand the "it's dominant and has a large ecosystem" argument, but I just can't wrap my head around how enough people chose it for it to reach this position.
I've evaluated it a couple times and it just looks poorly conceived. Fixes and "improvements" have rolled in, but they are also poorly conceived and themselves need fixes.
Of course I know it might just be me... I didn't get the point of tailwind either, until I used it.
But I've also used react for a reasonable sized project and I still don't get it.
- christophilus 4y agoWhat don’t you like, and what do you prefer? I like having view be a function of state (like in traditional web apps, except richly interactive).
- jmull 4y agoIt’s more of an idea than a library. The idea’s good but the implementation is awkward and incomplete. You’re endlessly writing boilerplate and incorporating libraries for even basic and typical cases that a more thoughtful design would make unnecessary. Even with multiple evolutions the problems are only somewhat resolved. The virtual DOM was a bad idea from day 1 and remains so. React wants components to be the unit of rendering, but an app wants a component to be a unit of app UI. These concerns end of conflicting and competing, which the dev has to do the heavy lifting to resolve, with things like useMemo/Callback. It uses javascript to represent HTML (HTML is already the ideal way to represent HTML declaratively). > what do you prefer Svelte, for the case you mention.
- spion 4y ago> HTML is already the ideal way to represent HTML declaratively I'm curious what you mean by "declaratively", and I wonder why everyone puts so much value into that particular idea. What is declarative? Is it different/better than using pure functions? Why? If not, why doesn't HTML have (pure) functions?
- jmull 4y agoDeclarative just means declaring the result rather than specifying how the result is achieved. (It naturally implies the existence of something else that can realize the declarations. E.g., HTML needs the browser to render it.) Pure functions are declarative. It's flexible so you can push it to the point where it's essentially a tortured imperative form, but you're probably doing wrong if you get to that point. The goal of react and other web UI libraries targeting browsers and web views is to render HTML, but dynamically, based on the immediate application state. HTML isn't dynamic and we naturally want to use Javascript for the dynamic part (due to history and Javascript's great flexibility). You can use HTML for the HTML and Javascript for the dynamic stuff. A lot of things work this way. But react decided to use Javascript for both the HTML and the dynamic stuff. JSX mitigates this to a degree, but it actually represents XML, not HTML. Thus you use className instead of class, close <input> tags, etc.
- spion 4y agoThe reason why I don't think HTML is the ideal way to represent HTML declaratively is because HTML does not have pure functions or any sort of proper first-class values.
- doodlesdev 4y agoThe original API when it was originally released was much saner. That was before JavaScript even had "classes" which meant React classes didn't have nearly as much boilerplate. After they migrated the API for React class components to be JavaScript classes it all went downhill. And then the functional people came and the rest is history.
- klysm 4y agoWhat's your preferred framework? I quite like react with hooks - it's the best thing (to me at least) I've used so far to make UIs.
- doodlesdev 4y agoFor web UIs my preferred framework is SvelteKit. It's based on Svelte which is more of a language than a library but code is basically HTML, CSS and JavaScript, it's simple and fast. I really want to migrate to using something such as Yew for scripting web UIs though, I can't take JavaScript/TypeScript anymore lol.
- meowtimemania 4y agoReact had a small simple API surface, made it super easy to create reusable components, and was more performant than some of the other dominant solutions (AngularJS)
- _boffin_ 4y agoi'm with you... i'm with you.