reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[Question] Is there a way to express the markdown string that changes by State?

Open Iced0368 opened this issue 2 years ago β€’ 1 comments

As far as I know, pc.markdown get value as only string.

So if i compile this code,

class State(pc.State):
    text: str = "**Bold Text**"

    def get_some_markdown_string_from_db(self):
        #Blah Blah
        self.text = "Some-Markdown-String"

def index():
    return pc.container(
        pc.markdown(State.text),
        pc.button(on_click = State.get_some_markdown_string_from_db)
    )

Unlike my expectation, sadly I got error because mState.text is not a string, but State variable.

But I want to get the strings written in markdown to State from db and display them in the markdown form.

Is there any way to implement this?

Iced0368 avatar Jan 20 '23 14:01 Iced0368

Ah ok we can fix this, looks like we need to make it accept var type as well. Thanks for pointing this out

Alek99 avatar Jan 20 '23 23:01 Alek99