It's controversial, I know, but hear me out. I'm not saying React is bad. I am saying that, like JQUERY, the modern web landscape has evolved and surpassed the need for it.
I'm not just picking on React either. Many frameworks can be discarded in favor of simpler solutions with less bloat, complexity, and overhead. Unfortunately trends like React and Typescript have become so entrenched that it is difficult to convince developers to move on.
And what's the motivation to move on? Many React developers in the wild only know React and have never even heard of modern web standards like Web Components. Further more, many React devs surround themselves only with other React devs which creates an echo chamber that reinforces the idea that React is the only way to build web applications. The irony is that many of the patterns that drive React are the same patterns that Web Components are built on. The difference is that React codebases only work with other React codebases, while Web Components can be used anywhere and are far less-likely to become obsolete.
Let's compare a React component to a web component:
React development typically uses JSX, which blurs the lines between content and functionality.
Unfortunately this makes React somewhat of an anti-pattern, but let's ignore that for now.
Here's a simple button that triggers an alert when clicked using a message from a prop named `message`:
When used, both of these manifest as a custom element in code:
The real difference here is that the <alert-button> web component extends the dom where the <AlertButton> React component requires an entire framework and compiler to work. While a comparison might be made to, say, c++ which also requires a compiler to run, my argument is there really isn't a need for react and/or its benefits do not outweigh its cost. React has to completely take over the development experience, where web components work with the existing experience and its patterns. Modern web standards and technologies move us forward, while frameworks like React hinder the future of the web development.
I get it, I really do: Learning something new is hard. Also, the benefits of working with the web, rather than against it, may not be immediately obvious. There are many benefits, however, though they are far too numerous to list here. Please paroose the rest of the web articles here, or visit MDN if you are curious to learn more.