Live data from Hacker News

Does anybody like React?

jsx.lol

271–280 of 353 posts

Re: Does anybody like React?

#271

As someone who lived through all major waves of JS for the last ~16 years, I do love react, in a sense: React is the worst JS framework except for all the others we've tried. I'd take React over the Angular 1 days any time. I'd take Angular 1's full-bodied MVC over the "build it yourself from scratch every time" approach of Backbone. I'd take Backbone's minimal MVC structure over the classic JQuery Soup architecture.…

I've never had the sort of problems I[0] had with React when using Angular (1 or 2), despite the apps having more complexity.

Maybe that's just anecdata, but I hated them a lot less. (I am mostly a Backend dev who also does Frontend, so I don't love any of them.)

[0]: and by that I mean my whole team at the appropriate time, it's not simply me misunderstanding things

Re: Does anybody like React?

#272

Earlier quoted context omitted.

`history.back()` shouldn't even exist, it's almost never correct to use it instead of a logical back button that works on the logical navigation structure e.g. going up a level, or to the previous page, etc. For example, if you are on Page 5, then pressing "back" inside the app should always take you to Page 4. `history.back()` could take you to any page, it's unpredictable.

Disagreed. In everyday speech "going back" means going to where you came from. If I'm at a friend's place at 123 Main Street and I tell him I'm going back, what I'm saying is I'm heading back to my home, not to 122 Main Street. The web should work similarly. And the idea of logical navigation is flawed because most websites don't have a well defined logical structure, nor is it feasible to have one. What is the previ…

I'm not talking about the back button. I'm talking about history.back() API. If you have a "back" button that is inside the page's viewport, it should work based on the page's logical model. So you go back from Page 5 to Page 4, regardless of where you were before. Only back buttons outside the viewport should work based on browser history. The history is part of the browser it's not part of the page.

Re: Does anybody like React?

#273

As someone who lived through all major waves of JS for the last ~16 years, I do love react, in a sense: React is the worst JS framework except for all the others we've tried. I'd take React over the Angular 1 days any time. I'd take Angular 1's full-bodied MVC over the "build it yourself from scratch every time" approach of Backbone. I'd take Backbone's minimal MVC structure over the classic JQuery Soup architecture.…

Agreed. Like you, I went from hand-written cgi-bin html to jquery to angular v1 to React. I will willingly reach for React as a tool - it does what I want to do.

I remember in 1999 being so psyched about changing a button image on mouseover. Went hard on jquery, little bit of angular and bootstrap. React was big for me because it’s one way data binding solved the kinds of bugs I had spent years dealing with. Vue svelte and others are cool but they are all very similar to me. I always encourage people to work at first without any framework because then you gain an appreciation for why these things exist (or you stay vanilla and constantly blog about it)

Re: Does anybody like React?

#275
My journey. Raw PHP + SQL Queries -> Python + server-side rendered HTML -> Ruby/Python APIs + ugly JS frontends -> Python + EmberJS (remember that?!) -> Go/Ruby/Python/I don't care anymore + React.

My problems with React are more about JS/TS and how other devs (it's never me! I swear!) can write terrible code that passes tests and isn't readable or maintainable. The JS Tradeoff is that we can handle rapidly evolving web landscape, but we have to deal with NPM and supply-chain hacks periodically. shrug

I am fine with the complexities of events, hooks and re-renders in React because we want to build interactive programs and nothing comes for free. Data fetching libraries like Tanstack Query solve one of the hardest problems of cache invalidation/re-rendering.

React was the thing that made me actually enjoy making interfaces for users. I just want to build stuff.

I experiment a bit with HTMX for my super simple single-page tools with some basic javascript, Next.js is nice but kind of thirsty to get you to use Vercel, I like Flask-Admin for really simple tools that must render a page from a server-hosted application.

Re: Does anybody like React?

#276

Earlier quoted context omitted.

Vue supports JSX, though to be fair, it’s not idiomatic and hence never shows up in any docs.

thankfull. i find reading JSX A visible eyesore, like an LLM reached its comtext length and just snorted blood and bile out its nose

I don't like it either, though I have less of a visceral reaction ;)

Re: Does anybody like React?

#277

As someone who lived through all major waves of JS for the last ~16 years, I do love react, in a sense: React is the worst JS framework except for all the others we've tried. I'd take React over the Angular 1 days any time. I'd take Angular 1's full-bodied MVC over the "build it yourself from scratch every time" approach of Backbone. I'd take Backbone's minimal MVC structure over the classic JQuery Soup architecture.…

Where would you put custom elements in your list?

Not comparable because custom elements don't handle rerenders elegantly without extra plumbing.

Re: Does anybody like React?

#278
post #254

Earlier quoted context omitted.

Angular 2+ is equally horrible. Having spent 6 years on various versions of Angular, their migration story time and again has been an incredible pain. These days I use web components for component writing and frameworks to handle routing, state management, bundling, and so on.

can you compare it to other frameworks? I migrated from Angular 4 to 18 (including ngrx and material) and didn't find it especially problematic. Migrating mostly was little effort and consisted of automatic migration and walking through the provided checklist (mostly to ensure I didn't miss anything important), but I don't have any comparison in the JS SPA ecosystem.

Vue 2 to Vue 3 has been equally painful for atleast one app I know about. Compare that to last three versions of Astro (with web components) and it has been a breeze.

> I migrated from Angular 4 to 18 (including ngrx and material) and didn't find it especially problematic.

The pain varies from project to project. Mine has been touched by a generation of developers of different levels of proficiency. A more disciplined project would’ve been easier to migrate in retrospective.

I think Angular ecosystem really missed the train with schematics (even ngrx!). Schematics could tackle a lot of toil if implemented exhaustively but apart from Angular and Material, nobody else seems to implement them effectively for brownfield projects.

Re: Does anybody like React?

#279

As someone who lived through all major waves of JS for the last ~16 years, I do love react, in a sense: React is the worst JS framework except for all the others we've tried. I'd take React over the Angular 1 days any time. I'd take Angular 1's full-bodied MVC over the "build it yourself from scratch every time" approach of Backbone. I'd take Backbone's minimal MVC structure over the classic JQuery Soup architecture.…

Have you used Svelte? I can’t see why anyone would like React more. The only upside I think react has it’s the IBM of frontend. No one has been fired for choosing React.

Re: Does anybody like React?

#280

Earlier quoted context omitted.

> I never get this take. A react component is not just a function, Exactly. I did a somewhat longer writeup a while back. https://blog.metaobject.com/2018/12/uis-are-not-pure-functio... The pull request is still open :-)

Interesting that you still stand by that, even after Apple moved to the exact same model with Swift UI. Narrowmindedly worrying about syntactical differences is contributing nothing to the conversation. The point is relinquishing control of state to the framework (be it via props, hooks or @State), and drawing the UI as a pure representation of whatever the framework tells you. Hence ui = f(state). This gets you a me…

Interesting that you would think Apple introducing Swift UI would have any bearing on the correctness of that blog post.

Why do you think it would?

Did you misread my post as "ha ha, Apple does it differently and therefore react is wrong"?

If so, you certainly misread it a lot, and you have the wrong person. I have tons of posts about Apple getting things wrong.

Anyway, did you miss the following part?

I also think that despite all the flaws, react.js and react.native are currently eating native development's lunch.

Clearly I made the point in my post that this approach has a lot of mindspace, despite the obvious flaws, so not sure how you pointing out that this approach has a lot of mindspace invalidates my post.

> Hence ui = f(state).

Every UI is always some mapping of the state. Otherwise it isn't really a UI, is it? What would it be, in your opinion, if it didn't map the state?

> pure representation

What does "pure representation" mean to you? I covered in the post that it sure as hell isn't a pure function of the state. And cannot be.

Did you miss the part where David Abramov conceded that point?

To elaborate a bit, React components aren’t always “pure” in strict FP sense of the word. They’re also not always functions (although we’re adding a stateful function API as a preferred alternative to classes soon). Support for local state and side effects is absolutely a core feature of React components and not something we avoid for “purity”.

> This [ui=f(state)] gets you a metric ton of advantages,

Well, yes. Like being a working UI, for example, which is why MVC is also structured this way.

But can you elaborate the specific advantages you believe the react approach gives us over, say, MVC?

The post elaborates that it would be really nice if UI were a pure function of the state. But it just isn't. And trying to pretend that it is might seemingly buy you some of those advantages, but at a huge cost.

Post reply on HN