How to do back-end in ReactJS- (Is it possible)

Viewed 1655

I am new to web development I want to create an application using React and Django but all tutorials show that by using REST API.

is there a way to use Django and react without REST API and perform CURD.

3 Answers

I recommend also reading this blog post https://www.valentinog.com/blog/drf/, where Django and React are integrated via mini React apps inside Django templates. I am not sure if it is the best approach, but may be useful.

No, it's not possible. Because even ReactJS is supposed to be on client side(Frontend). npm run build generates HTML/CSS/JS bundle for your app.
For backend, you might need node-express/Django rest... etc HERE is complete guide to integrate your app.

Yes, you can do that with Django but in the end you need a API, no matter if it is REST or GraphQL because Django take care about the backend and React do all the stuff in the front end and you will need a way to connect both (and you do that by using an API)

I recommend you to use Django Rest Framework if you want to use a REST API or Graphene if you want to use a GraphQL API, here is a very cool tutorial to start with graphql.

Related