My Adventure with ReactJS and Django I
I am digging ReactJS these past days. I am trying to figure out how it works this is because of my curiosity looking at the source code of a certain website with clean html structure--like having just a head, body and a division within it only. I was wondering how the HTML elements have been rendered on that page, and there I found out that it is possible by using ReactJS (I don't know if there are other library that can do it).
Example code (taken from their site):
I think the forte of ReactJS is managing the updates on the page. Some of the developer uses ReactJS when building a single page application, which is a trend nowadays.
You may take a look at their documentation for further information.
Note: DOM does not stand for Dirty Old Man! HAHA
Meanwhile, on the other planet...
Django--been using this Python framework for almost 3 years. I love it (but not as much as I love my girlfriend, JK). Great documentation, secured, with built-in Admin page and it's free and open-source. I won't talk more about Django as this is not new to me.
The struggle is integrating ReactJS with Django.
Given that Django has its own template system, by the way, it follows with MVC pattern. You create models (this is tables in the database), a controller somehow is the views.py in Django (kinda confusing), the View is the template; the UI. Integrating it with ReactJS, we need to replace the template. The struggle is the communication between these two different technologies. As for me, using Django REST framework can be one of the ways. We'll get the data through API and process it using xhr or axios or maybe ajax through jQuery in ReactJS. The problem with this, we can't maximize the capacity of Django in the template (page). I'll look more into it this coming days.
As for now, I have managed to deploy a simple ReactJS App in Heroku. Click the creature below and take a look at the source code.
I'll walk you through the deployed simple ReactJS App.
This file is actually generated when creating a ReactJS App. Whenever you install a package, this file will be modified and it will include the newly added package depending in your installation type.
Few notes, name should not have space, version also needs to follow the format x.x.x.
To be continued...