React Is a Code Smell

by stink - on Jul 13, 2021 11:55am to react programming code-smell comments(6)
As an experienced web developer, I often try to minimize how much front-end JavaScript code I write or not use any at all. I do this because it lowers the cost, improves the developer experience, improves the app quality and ensures the app will work for as many people as possible. I presume many other knowledgeable web developers feel the same. Picture the codebase for a large web app only having 100 lines of front-end JavaScript - sounds amazing.

Therefore, when I come across a potential client and they insist on React, I often lose interest in the project. Why do so many companies choose React? Who actually makes the decision to use React? Clearly some developers have no qualms regarding JavaScript heavy apps and they're making the decision. But React is probably chosen more often by non-developers that don't understand the consequences. The majority of web apps don't need a virtual DOM that can automatically update 200 elements every other button click.

Part of the problem is web-based applications are more text-based than other app types. And most people don't like text-based apps, find them boring and don't understand their value. So, what do we do? We try and turn the web into a platform for normal apps. Sometimes this makes sense, but I don't think people realize it's often nicer to have a text-based website than some type of app.

I recall an interview I had with a small company. We were discussing an existing project that we'd make improvements to, and their lead front-end developer said "We'll probably just throw React at it" – my heart skipped a beat. If you really think your site needs some JavaScript then try to use the built-in browser APIs. For example, if you need to make a couple AJAX calls use XMLHttpRequest().

People using React for web-based apps reminds me of people using Hadoop for applications that have 100 MB of data.
Some comments may be hidden. Show all.
  • by iloveny123 - on Jul 13, 2021 1:03pm
    Reminds me of Mongodb "web scale" video
  • by MadNis - on Aug 2, 2021 10:30am
    Interesting! As a freshly bootcamp trained developer with no real experience, these are thoughts to chew on...
    • by stink - on Aug 2, 2021 11:15am
      Did the bootcamp use React?
      • by MadNis - on Aug 3, 2021 12:06pm
        Yes. We also touched on Vue but didn't build a vue app.