dioxus/examples/generic_component.rs
2024-01-16 13:18:46 -06:00

24 lines
426 B
Rust

use std::fmt::Display;
use dioxus::prelude::*;
fn main() {
launch_desktop(app);
}
fn app() -> Element {
rsx! {
generic_child { data: 0 }
}
}
#[derive(PartialEq, Props, Clone)]
struct GenericChildProps<T: Display + PartialEq + Clone + 'static> {
data: T,
}
fn generic_child<T: Display + PartialEq + Clone>(props: GenericChildProps<T>) -> Element {
rsx! {
div { "{props.data}" }
}
}