reflex
reflex copied to clipboard
[REF-1626] Allow string fomatting in rx.html component
Describe the bug
Currently, the rx.html component src is not formatted.
To Reproduce Compile this app
from rxconfig import config
import reflex as rx
class State(rx.State):
"""The app state."""
myvar: str = "Blue"
def index() -> rx.Component:
return rx.fragment(
rx.heading(
f"The number is {State.myvar}"
), #works as expected
rx.html(
f"The number is {State.myvar}"
), #doesn't work
)
app = rx.App()
app.add_page(index)
app.compile()
Expected behavior The html format string should be processed correctly.
Screenshots
Specifics (please complete the following information):
- Python Version: 3.10.12
- Reflex Version: 0.3.2
- OS: Debian testing
- Browser (Optional):
From SyncLinear.com | REF-1626
potentially fixed by #2149
I am using multiline text like this
return rx.html(
"""
<h1> Hello {State.text1}</h1>
<h1> Bye {State.text2}</h1>
""")
But still cannot able to set the variable inside the html element Can you plz share guide /docs
Thanks for the update, will investigate.
This is fixed with the new immutable var system.