useFlask() - or how to use a React frontend for your Flask app

Adrian Mönnich

JavaScript Web Frameworks (AngularJS/ReactJS/...) Web Servers and MicroFWs (Flask/Tornado/Nginx/...)

Many Flask projects nowadays still use mostly static HTML, WTForms and just a bit of AJAX. All the JavaScript is usually included straight from .js files or just minified with Python tools like webassets.

But the JavaScript ecosystem has evolved a lot - one can now use tools like Babel to write modern JS even when targeting older browsers and a Webpack+Babel build is very straightforward and allows for advanced preprocessing of JavaScript code.

In this talk we'll even go one step further and not only use Webpack to build the assets, but also integrate a small demo Flask app with a React frontend where the Flask app only serves the static HTML page and uses a RESTful API to communicate with the React app.

We'll also look into how to keep convenient Flask features such as URL building in client-side code (using the js-flask-urls package) and of course React hooks will be used!

Type: Talk (30 mins); Python level: Beginner; Domain level: Beginner

Adrian Mönnich


Adrian is the lead developer of Indico, the Open Source Python-based event/conference management tool developed at CERN (where the WWW was born).

He's also one of the maintainers of the Pallets projects (Flask, Jinja, etc.) and likes to hang out in in Python-related channels on IRC.