简体   繁体   中英

React in Django or React as a standalone?

I have been researching how to create django react application and the best way to go about implementing it. From this link on creating a django react app states a few way to go about implementing it.

One way is to generate a webpack and using django to load the webpack another is to run it as 2 separate applications.

What are the obvious benefits of "React in its own “frontend” Django app: load a single HTML template and let React manage the frontend" vs "Django REST as a standalone API + React as a standalone SPA"

Because I do not see a need of generating a webpack and loading the application in django template where you could create a standalone react app and use Django REST for communication?

The first thing you would gain by splitting your frontend and your backend is modularity. With your application logic completely separated from your user interface, you have a slightly more modular web application. Modularity aids in a number of things, including testing, readability, and maintainability.

Also with a separate API, your backend logic can be reused by any anyone or any frontend be it a mobile app or anything you could imagine even your CLI.

Your goal would be to include the final bundle of your create react app in a Django page if I understood correctly ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM