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
+1
-20
@@ -3,13 +3,12 @@
|
||||
//! The example from the README.md
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus::web::launch(Example)
|
||||
}
|
||||
|
||||
fn Example(cx: Context<()>) -> VNode {
|
||||
let name = use_state(&cx, || "..?");
|
||||
let name = use_state(cx, || "..?");
|
||||
|
||||
cx.render(rsx! {
|
||||
h1 { "Hello, {name}" }
|
||||
@@ -17,21 +16,3 @@ fn Example(cx: Context<()>) -> VNode {
|
||||
button { "?", onclick: move |_| name.set("Dioxus 🎉")}
|
||||
})
|
||||
}
|
||||
|
||||
static Example2: FC<()> = |cx| {
|
||||
let (g, set_g) = use_state_classic(&cx, || 0);
|
||||
let v = (0..10).map(|f| {
|
||||
dioxus::prelude::LazyNodes::new(move |__cx: &NodeFactory| {
|
||||
__cx.element(dioxus_elements::li)
|
||||
.listeners([dioxus::events::on::onclick(__cx, move |_| set_g(10))])
|
||||
.finish()
|
||||
})
|
||||
});
|
||||
cx.render(dioxus::prelude::LazyNodes::new(
|
||||
move |__cx: &NodeFactory| {
|
||||
__cx.element(dioxus_elements::div)
|
||||
.children([__cx.fragment_from_iter(v)])
|
||||
.finish()
|
||||
},
|
||||
))
|
||||
};
|
||||
Reference in new issue
Block a user