New API for reactpy.html
#1279
Labels
priority-2-moderate
Should be resolved on a reasonable timeline.
release-major
Warrents a major release
Current Situation
Currently, the
reactpy.html
API feels a bit too wordy/verbose. When code formatters hit ReactPy code, it results in a lot of lines wasted to nothing but brackets or parenthesis.To demonstrate, just look at how many lines of code the following example is:
Proposed Actions
Here are some interfaces that have potential to be more compact.
Note that with both of the interfaces below, aince underscores are an invalid symbol in ReactJS properties, they would be automatically translated into hyphens. Single trailing underscores (ex _my_prop) would be automatically stripped to allow for for reserved keywords like
for
andwhile
. Perhaps double underscore could work as an escape hatch denotation if underscores are truly wanted for that key value?Context Manager API
This has the added benefit of removing a lot of parenthesis, but comes at the cost of potentially feeling unnatural to users converting from ReactJS to ReactPy. As a note, what would traditionally be a list of elements with the old API would be done via for loops with this context manager API.
This interface design could be inspired by NiceGUI or Textual.
Props within
kwargs
and children within callargs
.The biggest change is that ReactJS props would now be kwargs, and children would exist within a separate set of parenthesis call.
Previous discussions:
The text was updated successfully, but these errors were encountered: