Live data from Hacker News

Does anybody like React?

jsx.lol

191–200 of 353 posts

Re: Does anybody like React?

#191
post #184

Earlier quoted context omitted.

This sentiment only really applies if you’re coming from Vue 1/2 to Vue 3. The Composition API is definitely more like React but makes some better design decisions that make it easier to work with than React. Such as implicit reactivity.

If anything, composition API has taken the good parts from React. Once you get the hang of it, it’s amazing. Everything clicks together, is easily composable, and fully typed-safe.

Yup I'd sign this. We use Vue2 in a old codebase with options API and composition API in new projects. Both feel way better than anything I ever had to do with React (how many Hooks do you have to learn by now? 13?)

Vue just has a very simple lifecycle and combined with a simple store like Pinia it's just really fun to work with.

Re: Does anybody like React?

#192
post #13

Earlier quoted context omitted.

> I wanted to make a back button use browser APIs to go back if the coming from the inbox, just link to the inbox otherwise to preserve scrolling. I had to wire the actions from the html to call the function that goes back, then in my controller determine the previous page and send the JS enabled back button or the hard link. This is why I hate react spas. They're always trying to find some stupid way to break my bro…

They are actually speaking to trying to make an in-app back button use the history stack so that it _doesn’t_ “break” your browser’s back button. The problem with just calling history.back() with no fallback is it will bounce users out of your app (back to Google or wherever they came from) and PMs won’t like that…

`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.

Re: Does anybody like React?

#193
post #80

Earlier quoted context omitted.

"React is actually a library, not a framework" is definitely a thing people have said here and there since its inception. It's a distinction that doesn't seem to buy anything in terms of explanatory power or clarity, so I tend to ignore it.

I think it's a shortcut for saying that react doesn't have an 'official' routing library (like vue-router) and state management library (like vue's pinia). So depending on what you choose to manage routing / state, one react app can be quite different from another. Maybe nowadays there is a set of popular libraries for react so it becomes framework-y?

Vue-Router and Pinia have always been optional add-ons for Vue too, however, yet the Vue ecosystem seemed to to fine without those "aaakshually“ kinds of people that feel the need to micro-manage other people’s speech.

Re: Does anybody like React?

#194

One of the talks I really enjoyed is https://www.youtube.com/watch?v=h9SDuTSy7ps . In my experience, React's architecture is really good and lends itself quite well to making large applications. Unfortunately, React's biggest problem is that it forces you into the JS/TS ecosystem, which is, without a doubt in my mind, a compilation target rather than a system I wish to interact with natively. I'm happy with Elm -- th…

I like TEA but don't fully grasp how it scales for apps that may have reusable components or sufficiently complex pages. Is there an agreed-upon way(s) to deal with this? I know state is a big NO so it seems a bit at odds, but also does this essentially mean all Elm apps are just a global Redux and React app with no effects? Curious about more details to what you enjoy and how you like to work in Elm. Links also perfectly fine too.

Re: Does anybody like React?

#195
post #126

Earlier quoted context omitted.

>I see a lot of these "bare HTML pages" and they are lacking important stuff like i18n/a11y/WCAG compliance. Try adding all that back in and you'll see your website bloat right up. having lots of JavaScript tends to make more WCAG problems, because you do interactive stuff that needs to be described. Having bare HTML and the accessibility that is required for that is not tending to bloat in my experience.

Users need interactive stuff. If your site isn't interactive and your competitor's site IS interactive, customers almost certainly will prefer your competitor. When you try to chain that stuff across multiple backend-rendered pages, you get a whole other list of problems. If you need to track all the otherwise transient UI stuff on the BE, you have now created a whole mess of stateful APIs and turned horizontal scali…

Users wants something that will help with whatever they want done. And the quicker, the better. Interactivity is nice, but I never seen anyone complains about multipages applications.

> If you need to track all the otherwise transient UI stuff on the BE

So don’t add transient stuff? You send a page or a form according to the URL, the user does whatever it wants and either request a new page or submit the form. Each page is standalone like activities in an Android app. Anything transient is taken care of on the client side.

Re: Does anybody like React?

#196
I used to absolutely love react. Then I spent two years breaking apart a monolithic SPA into a bunch of federated micro frontends, and I saw the darkside of where React monoculture can go. When your entire website runs in the framework, complexity goes through the roof.

After I was laid off I realized that what I actually loved about react was JSX components, so I wrote a template engine on top of JSX and started doing server side rendering in my own apps. It's a quiet life

Re: Does anybody like React?

#197
post #96

Earlier quoted context omitted.

Vue doesn't solve problems better than React (and solves them worse if you have to learn all their proprietary files and DSLs instead of JSX), so there's not much of a reason to switch. The real discussion would be between React's vdom and something like Solid's signals.

It does, if you care about ergonomics. The reactivity model is simpler and arguably less error prone. It does have its own templating syntax, which is trivial to learn. No more cumbersome to learn than JSX, which is a templating language designed by the React team. Not sure why you chose to make the distinction between JSX and Vue’s DSL as if JSX wasn’t developed for the sole purpose of facilitating React’s virtual D…

JSX is a very thin layer of templating logic inside JS. Meaning you have all the language features available while templating. Some arbitrary JS can result in templating.

Vue's DSL is whatever language the developer implemented. Which is probably not enough, depends how much effort they put into it and how good they are in language design. Given that they cargo cult HTML tags to organize components in a pseudo-familiar but not-valid-HTML way, I don't have much confidence in their language design skills.

I'd take the former any day.

Re: Does anybody like React?

#199

Earlier quoted context omitted.

They are actually speaking to trying to make an in-app back button use the history stack so that it _doesn’t_ “break” your browser’s back button. The problem with just calling history.back() with no fallback is it will bounce users out of your app (back to Google or wherever they came from) and PMs won’t like that…

`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.

It’s really common that you can arrive on a view from different places.

For example on instagram you might click through to a post from the explore page or from someone sending it to you via DM. In either case pressing the back button rendered in the app, or swiping back, will take you back to where you came from. It feels natural and seamless. Although I guess there are other ways to skin that cat than history.back()

But I agree with you when there’s a clear hierarchy. Like on a job ad a “back” button should just be a normal link to the index of job openings.

Re: Does anybody like React?

#200
post #13
post #8

I like React. And I have seriously tried the HTMX/Hotwire camp. I wanted to make a back button use browser APIs to go back if the coming from the inbox, just link to the inbox otherwise to preserve scrolling. I had to wire the actions from the html to call the function that goes back, then in my controller determine the previous page and send the JS enabled back button or the hard link. My logic was spread out over 3…

> I wanted to make a back button use browser APIs to go back if the coming from the inbox, just link to the inbox otherwise to preserve scrolling. I had to wire the actions from the html to call the function that goes back, then in my controller determine the previous page and send the JS enabled back button or the hard link. This is why I hate react spas. They're always trying to find some stupid way to break my bro…

It’s an absolutely not true that react is especially bad for this behavior.

I think that lots of more traditional websites have very poor back button designs, especially around editing and form submissions. Remember clicking back and the browser prompting for form resubmission? Very poor design since you have no clue how the server will even handle form submissions. Or getting stuck deep in an application, hard to get back to the root. Or, consider encoding current page data that you’re editing into the URL, and back buttons don’t return to root and just strip query params. Often a very frustrating experience.

Often, “go back to what I was doing before” is what I actually want, not “go strictly to the previous state in the URL bar.”

Sure, plenty of people mess that up too, but the reality is that controlling the navigation stack can help you build more useful designs.

Post reply on HN