It isn't? I find React to be great to work with.
It isn't? I find React to be great to work with.
Most importantly, it’s also not particularly performant on the client side in real-world scenarios.
For evidence, here’s a guy testing major websites using his awesome react-scan tool: https://x.com/aidenybai/status/1861442057598062653
I think last year an Amazon frontend engineer wrote some tweets explaining they tried React and it was too slow. So they keep using Java for SSR and sprinkle vanilla JS. They were still using jQuery until a couple of years ago and probably still are in some parts of their site.
Someone is contesting that "frameworkism isn't delivering" when we have objective data to prove that it is in fact not delivering.
The Amazon store is just a good example because there's a lot of data about it, not because it's FAANG.
Please help me understand where I misunderstand
"No, trucks are good for X"
"Look at this use case (Amazon) with tons of objective data that shows that trucks are bad for X"
Are you arguing that web devs should ignore CWV for e-commerce sites?
The Amazon site is pretty ugly, yes, but it’s functional and fast.
But there's no inherent reason React couldn't be used for a page that basically shows pictures of products with a description next to them, the bottlenecks will have nothing to do with the frontend in a well engineered system for that type of site
Even freaking Google (who really should know better) suffers from that. Amazon's retail frontend uses plain HTML, so it works fine.
It's way too easy to put some state information into the context and then have your pages depend on it. For example, you have a page with a filter that is implemented via a simple state, and then a list of widgets that pass the filter. The widgets have a click handler that opens the widget details.
Now you right click on it. If you're lucky, it opens the widget details in a separate tab. However, the filter information is lost.
^ These two statements are at odds with each other.
React will return a pure browser link that behaves exactly as a browser link:
function Comp() { return <a href="some-link">text</a>; }
> The widgets have a click handler that opens the widget details.
>
> Now you right click on it. If you're lucky, it opens the widget details in a separate tab. However, the filter information is lost.So, the problem isn't React. The problem is people overriding default browser behaviour for their widgets. It was a problem before React, and it will be a problem long after React.
For example, here's Google's premier site about web technologies: https://web.dev/articles Check out the pagination links at the bottom. There's no React on the page
No it doesn't (in practice). React is typically used with something like React Router that takes over the whole sub-tree of paths. So links are handled by the single-page app itself, and this can lead to the state leaking through.
Yes, you don't _have_ to do it this way.
Yes , yes it does, in practice.
> React is typically used with something like React Router that takes over the whole sub-tree of paths. So links are handled by the single-page app itself,
"Taken over by Router", "handled by SPA itself" .... "React is to blame"
> Yes, you don't _have_ to do it this way.
Yes, you don't have to it this way, and this isn't React-specific. See Google's web.dev site built with web components
Links work fine, out of the box, react treats them the same way vanilla js does. JavaScript onClick events aren't links, and that's true whether you're using react or vanilla js.
> It's way too easy to put some state information into the context and then have your pages depend on it.
What do you mean it's too easy? If someone makes poor engineering choices because that's the "easy" thing to do, that's their fault, the tool didn't make them do that.
> Now you right click on it. If you're lucky, it opens the widget details in a separate tab. However, the filter information is lost.
This is true of JavaScript in general, it has nothing to do with react. In order for links to work, the server has to render pages that correspond to the link, whether that means encoding state in the url or pulling it from a session, this is required whether you're using react or literally anything else.
Just like how routing and history is “solved” but I encounter websites every other day that completely break my browser history.
I don't think that's true. More likely, you use react websites all the time and don't even think about it because the links work as you expect.
I worry that most people complaining here about React, including the OP, do not actually understand the very basics of React. Here someone is complaining about how React somehow messes with deep links. Without understanding that React does nothing to links. Nothing.
I'm discussing the retail site specifically because that's where CWV matter.
If a company has internal tools that take seconds to load it doesn't really matter. Captive users don't have much of a choice.
E-commerce is fundamentally small data once the user lands on a product page, so every subsequent link and click should be instant.