DEV Community

Discussion on: Why to use React if HTML/CSS/JS works fine?

Collapse
 
vonheikemen profile image
Heiker

How to choose wisely when to use and when not to use react.

As someone who learned web dev right before the frameworks took over, I got to say that I have never felt the need to use react.

Here is my thought process when it comes to choosing a tool.

  • Is this project literally a single index.html page? Okay, maybe I could do this without any tools.

  • So this project needs two or more pages. Can a tool like eleventy be enough?

  • Is this a data driven project with lots pages? fine, could I do this with laravel?

  • So this site will have highly interactive parts. Client side javascript can't be avoided. But before going full "React app", could I grab preact to make just the components I need?

  • I need a full on "web app" with lots of interactivity. Okay React, you and I are going to build some stuff.

Progressive enhancement is the key thing for me. I don't like adding tools if I don't need them. I still think "do I even need javascript for this? And if so how much?"

The thing is that the javascript community (or at least a very vocal part) has shifted the focus from websites to "apps". They are so comfortable with the tooling they use to build apps that they use for websites too. It isn't always bad, there are some good tools. But I bet someone out there is downloading 500mb worth of js to build a landing page, and that is where I think we have gone too far.