mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-24 05:03:06 +00:00
d9546d9504
* feat: use synchronous router design * feat: function to get router out of dom * chore: restructure workspace to use renderers as packages, not features
37 lines
784 B
Rust
37 lines
784 B
Rust
// ANCHOR: all
|
|
#![allow(non_snake_case, unused)]
|
|
use dioxus::prelude::*;
|
|
|
|
fn main() {
|
|
dioxus_desktop::launch(App);
|
|
}
|
|
|
|
fn App(cx: Scope) -> Element {
|
|
// ANCHOR: Clickable_usage
|
|
cx.render(rsx! {
|
|
Clickable {
|
|
href: "https://www.youtube.com/watch?v=C-M2hs3sXGo",
|
|
"How to " i {"not"} " be seen"
|
|
}
|
|
})
|
|
// ANCHOR_END: Clickable_usage
|
|
}
|
|
|
|
#[derive(Props)]
|
|
struct ClickableProps<'a> {
|
|
href: &'a str,
|
|
children: Element<'a>,
|
|
}
|
|
|
|
// ANCHOR: Clickable
|
|
fn Clickable<'a>(cx: Scope<'a, ClickableProps<'a>>) -> Element {
|
|
match cx.props.children {
|
|
Some(VNode::Text(_)) => {
|
|
todo!("render some stuff")
|
|
}
|
|
_ => {
|
|
todo!("render some other stuff")
|
|
}
|
|
}
|
|
}
|
|
// ANCHOR_END: Clickable
|