Use React without Node.js

2

I'm starting on this React. From what I'm seeing there's no other way to use React other than writing it in JSX and then compiling it with Babel to make it work. But to be able to use Babel from console I have to use Node.js. But the only one I have left is to use Babel from the web , but clearly this method is not practical at all. I'm using Django for the server side, so I do not want to have to start implementing server-side code in Node. Only use it for frontend . Is there any way to do it?

    
asked by Genarito 15.11.2016 в 04:12
source

2 answers

6

To use JSX, if you need to use a Transpiler as Babel , the best solution for not using Node would be to use babel -standalone via the CDN . Make your scripts separately and load them. babel-standalone offers you the tools to compile it online.

If you do not want to use the CDN , you could create a small Node installation on your local machine, use Webpack or babel -cli to compile the JSX and upload it to your server.

Here you can find more information about babel-standalone .

    
answered by 15.11.2016 / 17:27
source
2

If you want to avoid the configuration with babel and web pack and start as fast with the fron end I recommend react-create-app is the recommended cli by the facebook team to start your front end without messing with node, babel and webpack, everything is already set so you can start programming with react.

This application should be communicated with your back in Django at the time of service making http requests from the front to the back to get the information you need.

react-create-app has a command to make it buil of your project npm run build and you can upload it easily to your host as heroku aws etc.

    
answered by 05.07.2017 в 23:41