DEV Community

Discussion on: Who still regularly uses jQuery?

Collapse
 
arschles profile image
Aaron Schlesinger • Edited

Hot takes incoming!

A ton of sites I've worked on don't really need a larger framework, but I keep noticing that it's dangerously easy to convince myself that I need React, Vue or something similar.

If you're building Spotify, you need a framework. I get that because it's truly an app. But take Facebook or Twitter. Those feel like websites that don't need a framework. That being said, I use Twitter every day, so I'm not complaining or criticizing.

Now that my hot takes are over, I keep some rules in mind when I build a site with jQuery. Some of these I learned from using StimulusJS, which ironically enough is another framework!

  • Try to store state in the DOM itself, right next to the elements that need it. Use data-* attributes for this
  • Try not to use object-oriented design patterns. Keep the code as functional as possible
  • Use typescript when I can