Description
Current Situation
ReactJS has a method of HTML templating called JSX. We currently do not have an equivalent. We need to create a Python-based JSX equivalent that operates similarly to how it is used in ReactJS (Javascript).
The key difference here is we will not use a dedicated file extension (such as .psx
) in order to not break existing toolchains. Instead, we will rely on the tag string PEP that adds template literals to Python. Here is an example of the tag string syntax:
from reactpy import html
button_style = {"font_style": "bold"}
button_text = "Click me!"
view = html(t"<button on_click={lambda event: ...} style={button_text}>{button_text}</button>")
While we wait for the tag string PEP to be merged, we could potentially use an interim transpiler to use a similar syntax. The interim transpiler syntax would look something like this:
from reactpy import html
button_style = {"font_style": "bold"}
button_text = "Click me!"
view = html @ f"<button on_click={lambda event: ...} style={button_text}>{button_text}</button>"
Proposed Actions
Aid in the development of this proposed transpiler and then develop an html
tag function. An initial implementation of an html
tag can be found here.