React with Django

What is the advantage of using Django with React instead of just Django, where you hit the DB and render the information, style it with CSS and HTML? Is it Performance/scalability/maintenance?? I see a lot of React and Django projects but don’t understand the necessity of React for a small/medium sized business? I mean, if you want some async tasks you could just use AJAX, right?

Opinion

Using React/Angular/Vue is really helpful when the frontend of your application requires state or is complex is some other fashion. You’re able to reason about the DOM in a more programmer friendly way, although getting it setup is far from friendly to a new developer. It’s also easier (heavy opinion here) also able to write unit tests for small components using a frontend library than using selenium to test full actions against a running test server.

That said, it can be a lot faster to render things as partials on the server side, sprinkle in some jQuery or pure javascript to load them in via AJAX.

For me it ends up depending on the purpose. If you’re looking to learn things to use in the future, going the front-end library route may be helpful. If you’re trying to prove a product/business’s viability, speed is probably more helpful than learning new technologies.

// Opinion

Edit:
I did a quick search for something more detailed than my answer. Here’s a post from Stack Overflow regarding your question in a technology agnostic way: Does your web app need a front-end framework? - Stack Overflow

2 Likes

<opinion>

I’ll add to @CodenameTim’s excellent reply by saying from my perspective, it’s an issue of how much “interactivity” you need compared to the standard html-style browser page.

The more you are looking to create a “desktop-style UI”, the more you’re going to find it advantageous to use a more full-featured framework.

So I’d say it’s not an issue of performance, scalability, or maintenance. From where I sit, it’s just an issue of desired UI/UX - which also means it does not need to be pervasive throughout your entire site. You could have a site that is 90% tradition, and just one part of your site that benefits from something like React.

</opinion>

Ken

1 Like