why do I empty state but value is not empty #1015
Unanswered
bobwatcherx
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i have problem why i set self.new_todo == "" . but input text value not clear
my code
import pynecone as pc
class State(pc.State):
todo: list
new_todo: str
show_modal:bool
def list_todo(mytodo):
return pc.list(
pc.list_item(
pc.hstack(
pc.text(mytodo,size=20),
pc.button("edit",
bg="blue",color="white",
on_click=State.edit_todo(mytodo)
),
pc.button("delete",
bg="red",color="white",
on_click=State.delete_todo(mytodo)
)
def index() -> pc.Component:
return pc.center(
pc.vstack(
pc.heading("crud Todo", size="md"),
pc.input(
on_change=State.set_new_todo,
placeholder="new name"
),
pc.button(
"add new todo",
bg="purple",
color="white",
on_click=State.addnewTodo
),
pc.foreach(State.todo,list_todo)
),
Add state and page to the app.
app = pc.App(state=State)
app.add_page(index)
app.compile()
Beta Was this translation helpful? Give feedback.
All reactions