When to Use a JavaScript Framework?

One of my newsletter readers wrote me this

why use a JS framework? Could I not just make a website with html and css files using <script> to write my JS?

This is similar to asking "Why should I use a motorcycle? Could I not just get from A to B with a bicycle"

Yes, you can, but there are certain situations (like travelling 100 miles) where using a motorcycle would be more beneficial.

Specifically, I think there are three situations where choosing a framework makes more sense than using vanilla JavaScript.

1. Working on a complex project

If you’re working on a complex project, you might want to consider using a framework.

By complex, I mean a project that involves complex user interfaces requiring you to manage multiple states. You'll probably find yourself saving a lot of time by using a framework.

You would be focused on the project instead of worrying too much about some of the lower-level details.

2. Working in a team

If you’re working in a team, or with external developers, using a well-known, well-established framework with existing documentation help standardize the codebase and make it easier for everyone to collaborate.

3. Supporting different rendering methods

If you need to support different rendering methods, such as client-side rendering (CSR) or server-side rendering (SSR), frameworks provide it out of the box which is insanely beneficial.

You can do it with vanilla JS as well, but it gets really complicated.

Want to get better at JavaScript?

My goal with this blog is to create helpful content for JavaScript devs and my newsletter is no different!

I'll let you know when I publish new content, and I'll even share exclusive newsletter-only content now and then.

No spam, unsubscribe at any time.

Thank you, Taha, for your amazing newsletter. I’m really benefiting from the valuable insights and tips you share.

- Remi Egwuda