reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[REF-1626] Allow string fomatting in rx.html component

Open abdullahkhalids opened this issue 9 months ago β€’ 3 comments

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

image

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

abdullahkhalids avatar Nov 11 '23 05:11 abdullahkhalids

potentially fixed by #2149

masenf avatar Nov 13 '23 17:11 masenf

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

ipcloudlive avatar Jan 06 '24 07:01 ipcloudlive

Thanks for the update, will investigate.

masenf avatar Jan 08 '24 15:01 masenf