docs: move reference up a level

This commit is contained in:
Jonathan Kelley committed 2021-09-24 12:11:05 -04:00
1 parent f8e569a8be
commit 1464d2e0a7
24 files changed
+1 -1

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
use dioxus::prelude::*;
fn main() {}
pub static Example: FC<()> = |cx, props| {
cx.render(rsx! {
div {
}
})
};
// A controlled component:
static ControlledSelect: FC<()> = |cx, props| {
let value = use_state(cx, || String::from("Grapefruit"));
cx.render(rsx! {
select { value: "{value}", onchange: move |evt| value.set(evt.value()),
option { value: "Grapefruit", "Grapefruit"}
option { value: "Lime", "Lime"}
option { value: "Coconut", "Coconut"}
option { value: "Mango", "Mango"}
}
})
};
// TODO - how do uncontrolled things work?
static UncontrolledSelect: FC<()> = |cx, props| {
let value = use_state(cx, || String::new());
cx.render(rsx! {
select {
option { value: "Grapefruit", "Grapefruit"}
option { value: "Lime", "Lime"}
option { value: "Coconut", "Coconut"}
option { value: "Mango", "Mango"}
}
})
};