Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React.js with Django without using webpack

Tags:

reactjs

django

I'd like to start using React components in Django project. React would be used only for some parts of project (e.g. some filters, search box etc).

I looked to answer in other similar question but it doesn't work for me as I don't want to use python-webpack and espacially js-host as it will run additional proccess and is hard to configure and deploy.

Do anyone knows any other good solution how to use React with Django?

like image 806
Jaro Avatar asked Jun 17 '15 13:06

Jaro


1 Answers

So I've put together http://www.noobmovies.com using Django, Django-Rest-Framework and ReactJS. In a nutshell, I described this process in 2 videos I made available on YouTube.

video 1: https://www.youtube.com/watch?v=wU-KUapq1kQ

video 2: https://www.youtube.com/watch?v=6tiaiSr6Pqw

I like to pass essential data to the template in the Django view to render enough data to populate meta tags and things which are needed by search engines when the page is loaded for the first time. I then use the API to grab the rest of the data via REST AJAX calls and use React to render the JSON data into a nice UI. This allows the page to load quickly and get the data via subsequent api calls using React.

like image 166
Chris Hawkes Avatar answered Sep 20 '22 17:09

Chris Hawkes