How Can I use Django and React??
Copying my answer from stack overflow here:
You have two primary architecture options:
- A completely decoupled client/server approach using something like create-react-app and Django REST Framework
- A hybrid architecture where you set up a React build pipeline (likely using webpack) and then include the compiled files as static files in your Django templates.
These might look something like this:
Option 1 (Client/Server Architecture):
Option 2 (Hybrid Architecture):
The decision between these two will depend on your / your team’s experience, as well as the complexity of your UI. The first option is good if you have a lot of JS experience, want to keep your front-end / back-end developers separate, or want to write your entire application as a React single-page-app. The second option is generally better if you are more familiar with Django and want to move quickly while also using React for some parts of your app. I find it’s a particularly good fit for full-stack solo-developers.
Full disclosure, I’m the author of that series.