Flask-React
React extension for Flask applications with support for multiple add-ons.
##Usage
To initialize Flask-React, simply create a React instance and provide the
Flask instance. Additional parameters:
index_template: Index page template to use instead of default one.extensions: List of React extensions to use. Currently Material-UI, React-Bootstrap and Socket.IO are available.jsx_folder: Source folder for JSX files. If provided, .jsx files are converted using Babel on initialization.socket_io: Flask-SocketIO instance (socket.io is used).
from flask import Flask
from flask_react import React
app = Flask(__name__)
react = React(
app,
extensions=("material", "components"),
jsx_folder='static/react/jsx/'
)
if __name__ == '__main__':
app.run()
The React code goes into the static\react\js folder, or if you use JSX, the
folder you provided at initialization. The App.js file must contain an App
function that returns the contents of our application.
function App() {
return React.createElement(
"div",
null,
"Hello world!"
);
}
If you use JSX, your App.jsx would look something like this:
function App() {
return (
<div>Hello world!</div>
)
}
JSX files are converted using Babel CLI. In order for this to work, Node.JS needs to be installed.
Additional files that should be put in the static/react/ folder are:
favicon.icologo192.png,logo512.pngmanifest.json
Metadata
Release files for Flask-ReactJS 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| Flask-ReactJS-0.2.3.tar.gz | 926.5 kB | Without provenance | Details |
Release files / Flask-ReactJS-0.2.3.tar.gz
| Download URL | Flask-ReactJS-0.2.3.tar.gz |
|---|---|
| Size | 926.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d8b2be2c50c1658f812477e9ef48badc3f230259ba69a47ea84dc50a4eaf376
|
|
BLAKE2b-256 checksum How to use checksums |
8a56c53771bb908d441cda0f1d5cb77305f7c00b5f5cdfb5cc5c9e9f1b1db068
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.0
|
Security for Flask-ReactJS 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.