3 ms·
Single-codebase full-stack in Python is an interesting thing to do, but honestly that API for UI is ugly compared to React or even React-wrapped-in-Python by wa
by dragonwriter 4y ago
Single-codebase full-stack in Python is an interesting thing to do, but honestly that API for UI is ugly compared to React or even React-wrapped-in-Python by way of Pyodide. [0]
[0] the approach of this blog post: https://blog.pyodide.org/posts/react-in-python-with-pyodide/ https://blog.pyodide.org/posts/react-in-python-with-pyodide/
- jennasys 4y agoThe ugliness is something I struggled with a bit when I was first using Transcrypt to create React applications with Python. Even though that approach is more of a 1-to-1 Python-to-JS mapping instead of a Python wrapper, I felt all the calls to createElement affected readability. But once I started using a Python decorator to wrap the components in createElement, the code got a lot cleaner. Here's a basic example based on the official React tutorial: https://github.com/JennaSys/tictacreact2/blob/main/tictacreact.py https://github.com/JennaSys/tictacreact2/blob/main/tictacrea...