wip: move some examples around
This commit is contained in:
1 parent
cca7c5fc3a
commit
98a09339fd
70 files changed
+111
-117
No files matched your search
@@ -0,0 +1,29 @@
|
||||
use super::state::TODOS;
|
||||
use crate::recoil::use_atom_family;
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
#[derive(PartialEq, Props)]
|
||||
pub struct TodoEntryProps {
|
||||
id: uuid::Uuid,
|
||||
}
|
||||
|
||||
pub fn TodoEntry(cx: Context, props: &TodoEntryProps) -> VNode {
|
||||
let (is_editing, set_is_editing) = use_state(cx, || false);
|
||||
let todo = use_atom_family(&cx, &TODOS, cx.id);
|
||||
|
||||
cx.render(rsx! (
|
||||
li {
|
||||
"{todo.id}"
|
||||
input {
|
||||
class: "toggle"
|
||||
type: "checkbox"
|
||||
"{todo.checked}"
|
||||
}
|
||||
{is_editing.then(|| rsx!(
|
||||
input {
|
||||
value: "{todo.contents}"
|
||||
}
|
||||
))}
|
||||
}
|
||||
))
|
||||
}
|
||||
Reference in new issue
Block a user