Live data from Hacker News

Why React Re-Renders

joshwcomeau.com

121–130 of 168 posts

Re: Why React Re-Renders

#121
post #90

Earlier quoted context omitted.

FWIW, React has always been designed around some Functional Programming type principles, such as immutable updates. Immutable updates do in fact require that if you want to update `state.some.nested.field`, you have to make copies of _all_ objects in that path: `nested`, `some`, and `state`. This isn't unique to React. Yes, class component `this.setState()` lets you get away with mutations. That's not really a _good_…

> React has always been designed around some Functional Programming type principles, such as immutable updates If you think React has anything to do with Functional Programming, please read this ASAP: https://mckoder.medium.com/why-react-is-not-functional-b1ed1...

React was prototyped in Standard ML. Say what you want about whether you think it's functional enough but you can't revise history.

Re: Why React Re-Renders

#123
post #10
post #5

If you don’t mind a slight tangent, where would you start today to learn front end development with React such that you learn this sort of thing as you go?

The idea is you shouldn't really need to. You have tools to memoize expensive operations in a React-friendly way, but even then you shouldn't really have to think about render cycles. YMMV but I the only time I've ever had to really think about this stuff was when trying to frankenstein legacy jQuery code into a React app.

I get that, but I personally enjoy understanding the full stack. I built a cpu on breadboard from kit for fun, its just something I enjoy doing.

Re: Why React Re-Renders

#124

Josh's content is always very very high quality. I look forward to him releasing his online React course [0] so that I can recommend it to others who are starting out. My personal biggest not-total-comprehension is around Hooks / effects. I've followed tutorials, used them in production, etc. I'm comfortable using them but I also consider them a bit of a black box, which I don't like (e.g. I'm not sure how they're im…

They are yet more evidence that any human engineered system will inevitably 'diverge' to become the most complicated thing that just about works - what we might call the complexity horizon. Driven by the power of our 'ingenuity', even the most elegant constructions will find themselves drifting towards this horizon. It takes super human effort to resist the effect, and super humans to keep systems from escaping us.

Human-built systems’ complexity evolves until the limit of our IQ. Hire 140-IQ people, the systems will just evolve 20% further.

Re: Why React Re-Renders

#125
React would have been great in a functional language with immediate data structures.

Instead it’s used with JavaScript, where you have to constantly force yourself to create your prop objects in a very specific way to avoid or force (re)rendering.

It’s a constant struggle to control re-rendering. I still can’t believe React became as big as it is.

Vue and Angular just fit JavaScript better.

Re: Why React Re-Renders

#126

React would have been great in a functional language with immediate data structures. Instead it’s used with JavaScript, where you have to constantly force yourself to create your prop objects in a very specific way to avoid or force (re)rendering. It’s a constant struggle to control re-rendering. I still can’t believe React became as big as it is. Vue and Angular just fit JavaScript better.

It's very widely used in the ClojureScript world (via Reagent) where it indeed has a better impedance match.

Re: Why React Re-Renders

#127

React would have been great in a functional language with immediate data structures. Instead it’s used with JavaScript, where you have to constantly force yourself to create your prop objects in a very specific way to avoid or force (re)rendering. It’s a constant struggle to control re-rendering. I still can’t believe React became as big as it is. Vue and Angular just fit JavaScript better.

It's very widely used in the ClojureScript world (via Reagent) where it indeed has a better impedance match.

And sort of in Clojure with cljfx (React-like on JavaFX)

https://github.com/cljfx/cljfx

Re: Why React Re-Renders

#128
post #48

Earlier quoted context omitted.

> How do they onboard new members to their terrible setup, one might wonder? I can't speak for the specific companies you listed, but the number of times I've heard someone sing praises about a homegrown UI framework at their place of employment is approximately zero. The sentiment expressed about those is generally hatred and agony. That's not to say it can't be done well, but most don't. Also, a company being able…

> a homegrown UI framework I am deeply puzzled by both your and the sibling comment, which suggest that the only way to go is to build a framework. To advance such argument, especially when comparing something to React, is to forget that: - React also for a long time was advertised as a view-layer library for creating UI components, not as a "framework". - There've been numerous debates in which advocates of Angular…

> Years have passed, and web browsers have matured to the point when a native component model has become a reality.

This is not true at all, at least not enough to be able to completely replace React (or any frontend framework) with native APIs. You still need some sort of high-level abstraction(s) to tie everything together.

Re: Why React Re-Renders

#129

React would have been great in a functional language with immediate data structures. Instead it’s used with JavaScript, where you have to constantly force yourself to create your prop objects in a very specific way to avoid or force (re)rendering. It’s a constant struggle to control re-rendering. I still can’t believe React became as big as it is. Vue and Angular just fit JavaScript better.

It's very widely used in the ClojureScript world (via Reagent) where it indeed has a better impedance match.

It’s quite nice in ReScript as well: https://rescript-lang.org/docs/react/latest/elements-and-jsx

Re: Why React Re-Renders

#130
post #16
post #5

If you don’t mind a slight tangent, where would you start today to learn front end development with React such that you learn this sort of thing as you go?

The new version of the official docs is currently in Beta and this is really, really good: https://beta.reactjs.org/learn (In fact, I'll go further than this and add that the section on "Escape Hatches" should be re-read by senior/lead engineers, as many have misconceptions due to learning concepts ad-hoc from code of mixed quality: https://beta.reactjs.org/learn/escape-hatches )

Hmm. The escape hatches page is just “coming soon” for me?
Post reply on HN