Live data from Hacker News

React is holding me hostage

emnudge.dev

91–100 of 553 posts

Re: React is holding me hostage

#91
post #27

I've been working on a React side project for a few months now and looking at my company's apps plus posts like this I think people just miss the point. Stuff like this: >Things get more complicated when you start using React Context and start signalling updates in a parent component. The render cascades. Maybe one component fetches some data, some component remounts, and you run your state update again, delayed by a…

> State should change in response to user inputs.

Absolutely not only to user inputs, but any kind of event: response, websockets, push notification, worker task finished... a million things beyond the basic "click".

> If that function isn't pure you're gonna have a bad time.

Hooks let you deal with "component lifecycles" which make that function not pure. Only the most basic toy react components are pure, everything is about side effects IN your views.

Re: React is holding me hostage

#92
post #83

Earlier quoted context omitted.

> All blow up events come from a loud and extremely small minority. But whether they are making noise or signal, does not depend on number of people! Fair, this instance is 100% noise imo. We're engineers - we should be able to judge when something is silly. > React continues to dominate others because it has corporate backing while Vue doesn't. And angular was popular for the same reason before angular 2. I have nev…

You picked it because others before you had already decided and that was based off of the facebook name and backing. No one expected facebook to take such a pr hit over the last few years but ignoring why it become market leader misses the angular breakage event where everyone flocked from Google's framework to facebook's framework. The reasons for not using other frameworks seems copycat without logic. For example v…

FB's reputation has no bearing on my choosing react vs svelte vs x or y or z.

I continue to pick React for projects because it's better than the alternatives - not because others before me have picked it and I'm just copycatting.

I can understand why some dislike JSX. I happen to think it's a great abstraction that elegantly combines the declarative nature of HTML and the power of JS.

It's always worth noting JSX can and is used in libraries beyond React (hello Vue!) which further demonstrates its composable nature and flexibility.

Re: React is holding me hostage

#93
As a more backend guy who does some frontend, the main thing I like about React over alternatives like Svelte, Vue and SolidJS is React Native. React is maybe not perfect for the web, but it’s very, very good, and it’s also quite good for mobile via React Native. The more purely web-focused libs/frameworks have far inferior (or no) mobile options, while other cross-platform frameworks, like Flutter, suck on the web.

Being able to use such similar concepts/knowledge for both web and mobile, with strong results in both places, that’s something React is uniquely good at (AFAIK), and a huge reason to choose it IMO.

Re: React is holding me hostage

#94
post #50

Not to start an unholy flame war, but if you were to start a new project and didn’t need to worry about the ecosystem or workforce, what framework would you choose? Vue? Svelte? Something else?

Deno / Fresh.

I despise what NPM has become, and how complex / time consuming the build pipeline of front end apps is.

It’s still not a mature framework yet but hot damn does it excel at just getting out of my way and letting me ship stuff.

Re: React is holding me hostage

#95

Earlier quoted context omitted.

> All blow up events come from a loud and extremely small minority. But whether they are making noise or signal, does not depend on number of people! Fair, this instance is 100% noise imo. We're engineers - we should be able to judge when something is silly. > React continues to dominate others because it has corporate backing while Vue doesn't. And angular was popular for the same reason before angular 2. I have nev…

"Doesn't reinvent the wheel" they literally created a whole new language called JSX, I have 13 years writing JS and I dislike React and JSX is one of the reasons. As far I can tell reason it's picked a lot of times now it's market share, people see that is more popular than the competition so they try to learn it, creating a feedback loop that just makes it more popular.

JSX has been around for 7 or so years... that's a good amount of time. Over half of your 13 years :)

Do you avoid JSX when using Vue or other libraries that support JSX? Are you invoking the library function directly - React.createElement or vue's equivalent instead?

Re: React is holding me hostage

#96

The snark is strong with this one. It's a pretty major rant, without putting forward an alternative. The only viable alternative for me personally is VueJS and that's not my cup of tea either. I like React. It makes sense mostly. Is React perfect? No. Do I like React's recent transition to focus server side? No. But the problems it addresses are tough to solve. Show me a better solution and convince me its tangibly b…

Solid.js?

Re: React is holding me hostage

#98
post #93

As a more backend guy who does some frontend, the main thing I like about React over alternatives like Svelte, Vue and SolidJS is React Native. React is maybe not perfect for the web, but it’s very, very good, and it’s also quite good for mobile via React Native. The more purely web-focused libs/frameworks have far inferior (or no) mobile options, while other cross-platform frameworks, like Flutter, suck on the web.…

People seem to say Quasar [0] (a framework on top of Vue, websites, PWAs, mobile, desktop) is great in that niche, but I can only say that their documentation looks good.

[0]: https://quasar.dev/

Re: React is holding me hostage

#99
post #70
post #66

Earlier quoted context omitted.

But you can do that with algebraic effects. That’s kind of the point. You keep the clarity of declaring what you want to happen, and abstract the how to the effect handler.

None of that is true in React hooks. The negative sentiment towards hooks that you see here is because it is weird and complicated. Want to see how much simpler code can get when you code without React or any such fat frameworks? Take a look: https://github.com/wisercoder/eureka/tree/master/webapp/Clie... You just need to know JavaScript, HTML and CSS, not much else. The code is simple, and yet maintainable. No need…

How can you ever be sure that your state is valid when you’re putting it on the DOM? Worse yet, only parts of the state is stored there.

I can’t really call this code simple since it had to resort to timing hacks to get its functionality in order. A random 250ms delay and bam, bugs you cannot reliably reproduce

Re: React is holding me hostage

#100
post #33

Earlier quoted context omitted.

> Ultimately, React is f(newState) => UI. If that function isn't pure you're gonna have a bad time. React is not that at all. Unless your UI is very simple, React is not f(newState) => UI. React isn't functional. More on that here: https://mckoder.medium.com/why-react-is-not-functional-b1ed1...

You are both right. React components should render based on state that is managed by React, such that the rendered output changes only if the state changes. The complicated bit is the handling of events and changing the state. Hence why you get Redux for state but there is no “Redux for views”

React very heavily pushes "component lifecycle" events, since it was class based up until now with hooks. That is, changing the state in the view function itself.

It's not wrong, it gives you one kind of separation of concerns: components. But "the view is a function of state" is completely misleading IMO.

Post reply on HN