News for hackers. Stuff that matters.
Re:Using const/let instead of var can make JavaScript code r... by la_fayette on Wednesday October 21, 2020 @01:38AM (#24845048)
Yes true, but why should one favor react over e.g. web-components if it is so much slower?
Re:Using const/let instead of var can make JavaScript code r... by acemarke on Wednesday October 21, 2020 @01:49AM (#24845099)
React and web components are different tools trying to solve different problems.

Web components are primarily about trying to add new virtual HTML tags to "extend the platform".

React and other frameworks are about trying to build interactive applications that require larger-scale UI management, efficiently, on top of the DOM, by defining pieces of that UI as a tree of reusable components (and using techniques that web components don't have available to them).

If I want to add a color picker to an otherwise static HTML page, I might use a color picker web component.

If I want to build a meaningful-sized app, I'd reach for React.

Re:Using const/let instead of var can make JavaScript code r... by kaoD on Wednesday October 21, 2020 @02:56AM (#24845382)
Web components are not built declaratively.
Re:Using const/let instead of var can make JavaScript code r... by la_fayette on Wednesday October 21, 2020 @04:48AM (#24845955)
This declarative narrative is more or less a marketing gag, isn't it? Mixing Logic and Markup has always been an antipattern in web development. However, react calls this declarative and this is the new black now?
Re:Using const/let instead of var can make JavaScript code r... by ricksharp on Wednesday October 21, 2020 @05:32AM (#24846148)
I’ve been doing web since 1990s and I‘ve always thought spreading a UI element across 3 separate files (often in different locations) was an anti-pattern (or 5+ files In 5 different folders if you want MVC).

React is awesome because it allows feature-aligned separation of concerns (each component has a single job - render everything about a specific element - which is usually a well defined part of a specific use case).

Jsx is the best UI system ever in terms of productivity - speaking from experience: I’ve implemented production apps using dozens of UI frameworks/platforms - Html, WYSIWYG, Flash, WindowsForms, WebForms, Ajax, Asp.Net Mvc, Razor, WPF, Xaml, Silverlight, Knockout, Handlebars, PhoneGap, Ionic, Bootstrap, MaterialUI, Angular2, React w/ Class Components, React w/ Mobx, React w/ Hooks

I can tell you pros/cons of each of those. But at the end of the day I can develop an entire app in days in React+Hooks which would take me weeks in most any other.

Re:Using const/let instead of var can make JavaScript code r... by pkkm on Wednesday October 21, 2020 @10:58AM (#24848488)
Have you written up your views about various UI frameworks somewhere? I'd be very interested in reading a comparison from someone who's used so many.
Re:Using const/let instead of var can make JavaScript code r... by ricksharp on Wednesday October 21, 2020 @03:47PM (#24851327)
No, but it's a great ideal for a blog post! When I have a chance, I'll let you know.