Tuesday, August 11, 2020

spikelantern: The best frontend JavaScript framework for Django

A question I've seen asked a lot is "what's the best frontend JavaScript framework to use with Django".

Django itself doesn't make any recommendation on which frontend framework to use, or even assumes you're using a frontend framework at all.

So, which frontend framework should you be using? And which one "plays well" with Django?

Defining "the best"

The problem with such questions is that "the best" is often ill-defined. Best based on what criteria?

If you're starting a new project and wondering which one to choose, the disappointing answer I have for you is this:

The best frontend JavaScript framework is one you already know well.

That's it. If you, or your team, wants to use a frontend framework, the best one to use is the one that you and your team have the most familiarity with. That's because it's very likely that you will be more productive with it.

Django "plays well" with any frontend JavaScript framework, by virtue of the fact that it makes no assumptions and does not force you to use any framework. In that respect, it's all the same. At the end it's all JavaScript.

The actual question

But of course, that's not what you're asking.

If you already know a frontend JavaScript framework well, then chances are you wouldn't be asking this question.

It's likely you're asking this because you aren't familiar with any of them, and are wondering which one to learn.

There are a few factors to consider.

Choosing a frontend framework to learn

Ultimately, whichever framework you choose to learn, you want to actually succeed at learning it.

That means, to set yourself up for success you want one that has these properties:

  • Many good resources, especially for beginners
  • A large, welcoming community
  • One that is fairly mature, and isn't likely to change drastically within the next 6 months

Luckily for you, most mainstream frameworks today have all of these properties. React, Vue, and Angular all have very good resources, have large community support, and have APIs that are fairly mature. React, Vue, and Angular are all good choices to learn.

You can eyeball some of the tutorials for a framework to see which one works best for you. Do most of the tutorials contain a lot of esoteric jargon that you have trouble understanding? That's a sign that the community has yet to mature to an extent where it's welcoming to beginners, or the framework just has other goals that are incompatible with yours. That's alright, you can choose another framework and/or community that is more suited to you.

Also, I'd recommend avoiding very new frameworks. They might be good frameworks, but new frameworks tend to change a lot in their first couple of years. That means whatever you learn today might change drastically in a year's time.

Another thing to consider is how big the community is. If it's a mainstream framework like React, then it will have very large community support and is often backed by companies, and therefore is not likely to go away. Whereas if you're looking at a framework maintained by a single developer, there's a possibility that that single developer might just stop maintaining it. Don't roll the dice.

Other goals

You probably aren't learning this "for fun", but you may have other goals such as "getting a job".

Anecdotally, most employers, at least in my city, just expect familiarity in any JavaScript framework, rather than one in particular. What's usually more important is solid JavaScript skills. So, I wouldn't worry too much about this.

However, it's also true that you can be strategic about this by learning a framework that most employers use, so that you don't need to switch frameworks.

Check the job boards in your city, and look at what employers are looking for. You could also look at other cities.

In Sydney, where I currently live, React seems to be the most common framework used by companies, followed by Angular. There are also a few jobs for Vue developers, especially where the backend is Laravel (which endorses Vue as the framework of choice). This might be different in your city.

Still don't know what to choose?

If you're still not sure, I'd recommend just choosing React.

At the time of writing, React has arguably the biggest community among all frameworks, has tons of good resources, and is fairly mature. Furthermore, it's very popular among both startups and larger organisations. It's a good and safe option.

And since it's so popular, the likelihood of you ending up in a job where you need to deal with React is very high. That means it makes sense to learn it anyway, even if you end up choosing another framework as your "main".

So, if you're in doubt, just choose React. It is unlikely that this will turn out to be a bad choice.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...