reflex
reflex copied to clipboard
[Question] Is there a way to express the markdown string that changes by State?
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?
Ah ok we can fix this, looks like we need to make it accept var type as well. Thanks for pointing this out