Live data from Hacker News

If not React, then what?

infrequently.org

361–370 of 756 posts

Re: If not React, then what?

#361

The fundamental magic of react is that it lets you write code that renders O(n) UI states in a functional manner (i.e. by returning the HTML you want) rather than O(n^2) UI state transitions in a mutable manner (by mutating the page via nested callbacks), and somehow makes it kind of fast-ish People love complaining about React, but I don't know if they remember the pre-React world where you had to write the code to…

This. I still have nightmares sometimes.

If you don't use a framework you will probably end up building one, and it's not going to be as good as the existing options.

Re: If not React, then what?

#362

The fundamental problem with React and the like, is that it forced developers to unlearn the anchor tag. If you can change the url via js why use an actual hyperlink tag? Over the years, I'm seeing more and more unlearning of fundamental web from new frontend devs forged in boot camps.

But anchors and hyperlinks mean I make a new HTTP request to download the full page content, and make the browser re-draw only the parts that changed[1].

On the other hand, with something like react-router you can now just download the full page content[2] but without [3], and then make the browser re-draw only the parts that changed.

Only half-joking though. People can build things whatever way they like, and these frameworks can have good trade-offs. But sometimes the justifications devs give[4] just sound like they're reluctant to say "because I already know it, so I'm more efficient with it" or something like that.

[1]: "Paint holding".

[2]: Code splitting.

[3]: These savings are probably offset by the library's 19kB, anyway. Or with that small icon that was inlined as base64.

[4]: Which they don't need to give to anyone, unless it's for a situation like an employer asking for it.

Re: If not React, then what?

#363
post #347

My answer: Something not JS, or even TS. So it has to compile to JS or WASM or both. Rust is cool. Dioxus looks really promising. https://dioxuslabs.com/ Elm is great. Actually quite mature in my experience. (Sure there are talks about the development model and release cadence, but still...) Same $LANG as on the backend, as many langs compile to JS and/or WASM nowadays. But then how do you feed the browser a DOM? You…

> Rust is cool. Dioxus looks really promising.

And Leptos: https://www.leptos.dev/

And Sycamore: https://sycamore.dev/

And Yew: https://yew.rs/

Re: If not React, then what?

#364

Earlier quoted context omitted.

> React performance concerns in the real world are typically measured in, at worst, hundreds of milliseconds. I disagree. Try loading up a library heavy site (i.e. React plus a half dozen associated helpers for state, UI and whatever, which is pretty common) on an old or cheap Android device. It can take multiple seconds before the page is fully loaded. Even once the libraries are loaded, React sites often involve pa…

>Try loading up a library heavy site (i.e. React plus a half dozen associated helpers for state, UI and whatever, which is pretty common) on an old or cheap Android device. that was the case in 2015 when entry level android devices were quite slow, nowdays a cheap $200 android phone has at least 4-6GB of RAM and an eight core processor. if that isn't enough for your react powered site, you are doing something very wr…

Keep in mind that React is very single threaded (as is nearly everything in javascript). These phones might have 8 cores; but they tend to have the same single thread performance as 10+ year old iPhones.

Re: If not React, then what?

#365

I've been building sites since the 2000s and I'll let you know why React or jQuery "won." It's because when you write code using these libraries, your code looks nice . I cannot say that for a LOT of libraries, especially MOST frameworks. Sorry for calling AngularJS out but look at a code sample from early Angular: https://stackoverflow.com/questions/42823436/angularjs-error... (It looks terrible.) React will be unse…

> React will be unseated like jQuery got unseated when someone makes something that looks nicer.

The solution is WebAssembly. Make your code look as nice as you want, as readable as you want, in whatever language you want.

No more JavaScript limitations.

Re: If not React, then what?

#366
post #170

Earlier quoted context omitted.

You shouldn't write a single useEffect in the first year or two of your career in React. Why people are so keen on stabbing themselves just because there's one or two weird shaped forks in the kitchen drawer. Why do suddenly everyone tries to use it for spreading butter or peeling eggs? Just understand what unidirectional data flow is and you are golden. You know the entirety of React you should be using for your fir…

That’s true. Just to note, I never claimed otherwise. See, useEffect is an evil remark. This is more based on my experience working with an average React codebase. As for your question, “Why does everyone suddenly try to use it for spreading butter or peeling eggs?” I guess part of the reason is that many people rely on older tutorials and patterns where the usage of useEffect was much more tolerated or even encourag…

How do you fetch and persist server side data without useEffect? (Assuming vanilla react)

Re: If not React, then what?

#367

The fundamental problem with React and the like, is that it forced developers to unlearn the anchor tag. If you can change the url via js why use an actual hyperlink tag? Over the years, I'm seeing more and more unlearning of fundamental web from new frontend devs forged in boot camps.

You're right that there's certainly bad HTML produced by React apps out there. But there's good HTML, too!

As far as I can tell, React let's you write HTML in both the right and wrong ways, like all frameworks (including plain JS).

Maybe it seems like React is worse in terms of HTML because of how popular it is? There are more users of it, so more potential examples of bad HTML?

Re: If not React, then what?

#368
post #168

Reading over the authors primary reasons to not use React, they strike me as fundamentally misguided - mostly solving problems that most people don’t have. One reason it says that React is a poor choice is performance issues. But front end performance issues are almost never the most pressing issue to deal with. React performance concerns in the real world are typically measured in, at worst, hundreds of milliseconds…

> React performance concerns in the real world are typically measured in, at worst, hundreds of milliseconds.

Try opening facebook.com; click the messenger, (+1 second) Click one of your chat groups (~2 seconds)

This is merely just to show something

From what I have seen, its quite easy to have performance issues with React

Re: If not React, then what?

#369

Earlier quoted context omitted.

You're going to love Vue. Took me about half an hour to switch and be productive and never looked back. I've switched multiple teams/devs to it as well. If not just for the devtools experience. I switched right before all the messy React stuff started getting released.

To me, the best part of react/jsx is that if you know HTML, and you know JavaScript, you can easily write JSX. I'm primarily a backend engineer, but I grokked JSX pretty much instantly. Anything in scope in JS is available in the JSX. Vue templates are, well, yet another funny little template language. The hello world example already seems way too magical. Just let me use the language I already know.

Fun fact, you can use JSX with Vue and get the benefit of its built-in reactivity framework. I've done this for small prototypes and it's quite nice. My favourite part was that without .vue files, I could compile the whole app using esbuild instead of fiddling with webpack (yes yes I will try Vite one day).

Re: If not React, then what?

#370

Earlier quoted context omitted.

You're going to love Vue. Took me about half an hour to switch and be productive and never looked back. I've switched multiple teams/devs to it as well. If not just for the devtools experience. I switched right before all the messy React stuff started getting released.

But why would OP or I switch away from React when we believe it's mature, stable, fast enough, and has a huge community, resources, and ecosystem? And perhaps most important of all: it's the tool we know.

Because it’s not and people hate these sites…I’m sorry…”apps” you make.
Post reply on HN