Live data from Hacker News

Just Fucking Use React

justfuckingusereact.com

41–48 of 48 posts

Re: Just Fucking Use React

#43

Why not Vue? Unlike React it doesn't recalculate everything on every mouse move event. Also I would like something that doesn't require to install Node.JS and unly packer like Webpack which invents its proprietary syntax instead of using standard EcmaScript. I like to make small apps that I run by clicking on HTML file and I don't have time to go to console and install things or type commands just to open a webpage.

> and unly packer like Webpack

Huh? People are still using Webpack?

Re: Just Fucking Use React

#45

Earlier quoted context omitted.

React can be very performant with little optimization if you apply FP principals to it, which makes sense since it was built with the goal of using FP to do frontend work. If your whole tree is recalculating on every mousemove event, that is a giant code smell to say the least. You’d have to architect the app to work that way.

FP principle is that functions are first-class objects and one can pass a function to a function. I don't see how it helps programming the UI. Maybe you meant using immutable data structures? I mentioned that and noted that they have their own issues and generally are a pain to use. > If your whole tree is recalculating on every mousemove event If you update a variable in the root component, that will happen. Am I wr…

Thats the 1-sentence summary of FP, but there’s a lot more to it. Immutable data structures are part of it, although less important because of how props are scoped.

Composition, my friend. That’s the key. If your whole tree is rerendering whenever your state changes, it’s a failure to compose your components properly.

FP includes strategies for limiting side effects, relying on architectural patterns that push side effects to the edges of your application. This is a very sane way of working in react.

And a lot of prop drilling can be reduced by passing down closure functions with curried values in them.

Re: Just Fucking Use React

#46
post #22

Earlier quoted context omitted.

This is the virtual DOM mental model of react, and it is pretty much entirely wrong. - React doesn't really distinguish between DOM components and your own components in how it evaluates. It's all part of the same "VDOM" tree. Creating and updating HTML tags doesn't flow differently from updating the props on your own components. - React does sparse updates, starting at the topmost component(s) whose state changed. F…

> If a component is memoized with `memo(...)`, then a re-render will be stopped if it has the same props as before This works only with immutable data structures. Am I wrong? Because a modified array will pass the identity test (=== operator). If you are using mutable data structures, you cannot use identity operator to detect changes. Also if "memo" optimization is that good why does one have to add it manually? > I…

You’re right, memo is a lazy thing to do and often fails to optimize. At best it reduces rerenders but doesn’t speed up slow behavior.

Re: Just Fucking Use React

#47

So, I should just use vanilla JavaScript? Well if you say so.

Actually data-binding UIs (UIs that automatically update themselves when model variable changes) allow to do more in less time. So you just spend more time to reach the same result. For example, I don't want to use non-reactive UIs (like vanilla JS or GTK) anymore. And it's sad to see that many (or maybe even most of) open-source projects still manually write code to update the UI and lose time on this. It's like try…

customElements with attributeChangedCallback are reactives.
Post reply on HN