Live data from Hacker News

React is winning by default and slowing innovation

lorenstew.art

821–830 of 866 posts

Re: React is winning by default and slowing innovation

#821
post #590

Earlier quoted context omitted.

> If you don't want that, you gotta bring a wrapper or another reactivity library/framework. Being able to use a different library with a component, instead of the component being tied to React, is the whole point. React isn't 100x more popular because its reactivity system or any other feature is 100x better. Half the reason it's popular is network effects – too many frontend components / libraries are made React-on…

I get your point. I'm fully with you that it makes no sense to use React and write React apps if you can achieve the same without React. I hate the fact that many great frontend components only work with React, especially considering that React didn't properly support Web components for ages, whereas almost every other framework had no problems with them. However, out of the box, Web components don't come with almost…

> Comparing React to Web components is comparing apples to oranges.

I mean, yes, but you're the one making this comparison, saying that WCs lack reactivity etc.

Web Components are an extension of the DOM – a low level browser API. They are similarly low level. That's expected. I don't need or expect them to be something more.

I am happy that I can use any reactivity system I want to implement a Web Component. That's a feature, not a bug. Having implemented a reactivity system myself, I know that there isn't a perfect one, the design is full of tradeoffs, and I'd rather not have a blessed implementation in the browser, because it will inevitably turn out to be flawed, yet we won't be able to retire it because "we can't break the web". A blessed implementation like that would benefit from network effects just like React does, and would have all the same problems as React, plus the inability to rapidly innovate due to the browser's unique backwards compatibility concerns. I'd rather ship an extra 3KB and avoid all those problems.

Re: React is winning by default and slowing innovation

#822
post #788
post #154

Earlier quoted context omitted.

If every other framework failed because of , that does indeed sound like React won due to its own merits.

Merits yes technical merits no. Products rarely win because of technical merits. Products win with marketing. Technical merits can add another layer to the marketing but without facebook's brand people would still be on angular.

It's unclear to me that Facebook's 'brand' is superior to Google. Google has plenty of popular, successful open source projects. If Facebook's brand was all that was needed for it to crush Google, wouldn't Pytorch be crushing Tensorflow right now?

Re: React is winning by default and slowing innovation

#824

Earlier quoted context omitted.

This is factully wrong. You are confusing react with nextjs. React produce html documents, and the first usecase was reactdom, a pure client rendering library.

No. I'm speaking from experience having used React from its very first release. You're not only factually wrong about me being wrong, your knowledge is obviously quite limited. React has always initially rendering components on the server, then hydrated on the client. You don't have to take my word for it, download the initial release and try it out yourself: https://github.com/facebook/react/releases/tag/v0.4.0 Go a…

Aren't you a treasure, thank the gods you're here to condescend us plebs.

Re: React is winning by default and slowing innovation

#825

Earlier quoted context omitted.

> Go read pg’s comments on downvoting. Hmm. That sounds an awful lot like "It's true! Google it!"

Well if you’d googled it you’d have seen it was true. From pg in 2008. >I think it's ok to use the up and down arrows to express agreement. Obviously the uparrows aren't only for applauding politeness, so it seems reasonable that the downarrows aren't only for booing rudeness. https://news.ycombinator.com/item?id=117171

Well I'll be danged.

Re: React is winning by default and slowing innovation

#826
post #427

Earlier quoted context omitted.

I love boring stack. No nodejs and its dependence hell, no compilation, no frameworks that need reading encyclopedia to make a simple form :) PHP or blazing fast PHP-fpm, MySQL/MariaDB or Postgres, json for config, jQuery… it is good enough for most cases. For Netflix, Spotify, Facebook, Waze, and other heavily used sites with millions users… it is a different game.

Node.js is boring stack for me. But instead I am asked to work with tools from the wet nightmares of React developers. Stuff that runs in Node - yet is designed as if Node, the DOM, or the OS, didn't exist. Now that's never boring. They can't even consider that everything might work better without their favorite tool, than with it. It's surreal. And awful.

Some people seek innovation. :)

Everytime I see some new editor, I know that people are really innovative because THIS will be THE ONE. /s

Re: React is winning by default and slowing innovation

#827
post #558

Earlier quoted context omitted.

What code are you using to reactively render state? Or do you write all DOM manipulations manually and just accept the problem of state explosion ?

Here is an example: /lib/dashboard/dashboard_script.ts https://github.com/prettydiff/webserver When you aren’t using framework like components state restoration is a single function that runs only on page load. There is no state explosion and on localhost the SPA fully renders and finishes state restoration in about 105ms from http request.

First off, thanks for sharing this, because I've seen a lot of your comments on these sorts of threads about web development, and it's helpful to see what your approach looks like in practice.

There are a bunch of amber flags that immediately stand out, like this being an almost 4k line file with a commit history by only one person, and an idiosyncratic approach to naming and formatting. None of that is necessarily bad on its own, but this feels like code that is written by the author for themselves, rather than for any other potential readers of the code. It's a lot easier to write code if you're the only reader, because you can keep a lot of the code's context in your head, and you don't need to write it down in the same way.

I skimmed through the start of the file and then jumped up the bottom looking for an entry point. From there, the table state jumped out to me as a thread I could follow, so I started exploring that.

The first thing that jumped out at me was how much defensive programming you are doing. There are lots of "if state X is not null" or "if event is not null" sections where it's not clear from the types or the logic that these values can ever be null. This makes me a bit nervous, because if you don't know whether something can be null or not, the reader is going to find it even harder to tell.

The next thing I noticed was how difficult it is to follow state changes around. Part of this is state being set in multiple places at once (e.g. `state.tables` and as data attributes on elements), but also because you use both `.dataset.xyz` and `"data-xyz"` fairly interchangeably, which makes it difficult to jump to the usages of some bit of state if that uses a different syntax.

This got me (finally) to some of the DOM manipulation code, which is what I was just eager to see in the first place. I landed in the tables.populate function, and the most surprising thing that jumped out to me here is that every table seems to be special-cased with a bunch if-else statements, partly for the rendering of each row, and also for updating the payload. Searching through this code, it seems like this mechanism of switching on the type of each module/table is all over the place, and that updating one part of the code is going to have massive knock-on effects on other parts of the code as well.

I'm going to stop here because I need to get on and do other things. I agree with you that you have largely managed to avoid building your own framework, but I think this is very much to the code's detriment: a small amount of abstraction would go a long way here in terms of, e.g. isolating the different tables from each other, or managing state effectively.

I can fully believe that you find it easy to write and maintain this code, but I suspect that has a lot more to do with you being the sole maintainer of this code than it does the clarity of the code. I see people confuse these two ideas a lot, but it's important to separate them.

Like I said at the start, I'm grateful for the chance to see your approach, and if it works for you then my opinion if it doesn't really matter. But it unfortunately does not convince me of your claims about the benefits of this style of development.

Re: React is winning by default and slowing innovation

#828
post #768

Earlier quoted context omitted.

You can write const [a, b] = useState('x') in vanilla js and typescript. Hence it is not magic syntax .

Yeah, that's vanilla syntax. The semantics are fairly magic though. The component function that calls useState though isn't a normal function, it's a function that must be called in a special way by the React runtime in order to line up all of the hidden state that React maintains so that it can magically infer the data that your `useState` call maps to and then there's more magic to maintain the lifetime of that dat…

Yes, but it is not syntax. It's a contract with the library. React is completely usable using vanilla JS syntax. Same cannot be said for Vue and Angular. It feels a bit like talking about apples and oranges in this thread.

Re: React is winning by default and slowing innovation

#829

Earlier quoted context omitted.

Innovation is not really measured in terms of how well something "scales down".

As a counter example, consider the jerry can from WWII. It was easy to handle a single unit to refill a vehicle, and it was also easy to stack millions of them for shipping. Another example is the internet itself. You can have a local LAN of a few computers or a global network of billions. So I'd say that to some degree innovation is measured by how well something can scale both up and down, but of course that's not…

Both of your examples show that scaling down is pointless if it doesn't scale up.

Re: React is winning by default and slowing innovation

#830
post #590

Earlier quoted context omitted.

I get your point. I'm fully with you that it makes no sense to use React and write React apps if you can achieve the same without React. I hate the fact that many great frontend components only work with React, especially considering that React didn't properly support Web components for ages, whereas almost every other framework had no problems with them. However, out of the box, Web components don't come with almost…

> Comparing React to Web components is comparing apples to oranges. I mean, yes, but you're the one making this comparison, saying that WCs lack reactivity etc. Web Components are an extension of the DOM – a low level browser API. They are similarly low level. That's expected. I don't need or expect them to be something more. I am happy that I can use any reactivity system I want to implement a Web Component. That's…

Fair enough. I agree with you. It occured to me that the comment I originally replied to that claimed "Web components are the way out of this trap" doesn't mean that you can't add helpers for reactivity.
Post reply on HN