Live data from Hacker News

React is holding me hostage

emnudge.dev

131–140 of 553 posts

Re: React is holding me hostage

#131
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?

I find Svelte phenomenal.

But I'm also interested in trying Solid.js and Vue, and for some types of projects I'd likely even go Astro+Svelte or Astro+React.

Hard to speak authoritatively on the matter though because over my career I've only done vanilla JS, jQuery, Backbone.js, React, and then Svelte, in that order, and each has felt like a leap forward in evolution

Re: React is holding me hostage

#132
I'm still a React guy. I've also worked with Angular and Vue and toyed with Svelte.

People tend to compare these frameworks on things that don't matter - often it's performance. We used to compare React performance to AngularJs performance too, which was meaningless.

VDom is nice. Reactivity in signals is nice. Limiting rerenders is nice. But I choose frameworks because of developer ergonomics.

The killer feature for React was - 1. JSX - typing and auto-complete for components, colocation. 2. No direct dom access. (Good bye $element)

Most frameworks outside react still use templates. Even when they support JSX like syntax (aka vue 2.0) the default are templates. Templates are a no go for me. I use them for blogs or static websites, but applications are easier to make and maintain with actual javascript.

Luckily none of the other frameworks, even Angular, have rampant direct dom access anymore.

Hooks aren't a problem in general. It's just the useEffect hook. Unfortunately that's a big problem. That hook should never have existed. And it was clear from the start it'll be a pain from the limitations around it. It requires a mental model detached from everything people are used to and from other things around it.

When using React I usually just use MobX and everything just works.

Re: React is holding me hostage

#133
There is this niche movement that argues that good code should be very long lived. It should solve problems in a fundamentally efficient way that makes it hard to turn into obsolete and throwaway code.

There are not many examples of such code bases. Maybe numerical algebra libraries come close.

Reading through the comments it seems that providing (fairly basic by now) UI functionality on cross-platform basis has not matured to the point of providing a stable paradigm.

Given how many people and for how long have been banging on this problem it feels a bit strange.

Surely people can find better use for their time and energy than churning through half-baked frameworks?

Re: React is holding me hostage

#134

There is this niche movement that argues that good code should be very long lived. It should solve problems in a fundamentally efficient way that makes it hard to turn into obsolete and throwaway code. There are not many examples of such code bases. Maybe numerical algebra libraries come close. Reading through the comments it seems that providing (fairly basic by now) UI functionality on cross-platform basis has not…

Incentives.

One has to ride (and eventually) create trends to sell.

Re: React is holding me hostage

#136
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…

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

The clue is in if everyone is missing the point but you, may be start with more introspection. :)

I will give an example of a side project I am working on. The homepage has two sub components, one when the user is logged in, one when the user is logged out.

Now, when the user logs in, the state of the homepage parent component needs to change, the state of the nav bar needs to change etc.

Your problem is in assuming newState is completely described locally which isn't always the case.

Re: React is holding me hostage

#137
post #37
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...

setState is a convoluted way of passing the newState to components. useEffect is a side effect and if you use it you're gonna have a bad time.

If you need to fetch a piece of data when the component loads, how do you do it without useEffect?

Re: React is holding me hostage

#138
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?

Svelte is a no-brainer here.

How’s debugging?

Re: React is holding me hostage

#139

Earlier quoted context omitted.

I went and checked, and it is a bit buried at the bottom of the useState explanation when explaining what an example does: > Line 9: When the user clicks, we call setCount with a new value. React will then re-render the Example component, passing the new count value to it. https://reactjs.org/docs/hooks-state.html I think they assume you'll figure out that it must do so to function at all.

This has been true even in the old class components. A component always updates when props update.

It's about state not props. But yes state is more or less implicit props.

Re: React is holding me hostage

#140
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?

Standard ones I would like to try are Solid/Svelte/Vue

- Lit if I wanted to share components with other teams

- Marko if the site had lots of static content

- Qwik if speed was paramount

- Fresh too looks interesting

Post reply on HN