2023-09-15 14:13:36 +00:00
|
|
|
//! Run with `cargo-expand` to see what each one expands to.
|
|
|
|
//! This file is named `inlineprops.rs`, because there used to be a `#[inline_props]` macro to
|
|
|
|
//! do this. However, it's now deprecated (and will likely be removed in a future major version),
|
|
|
|
//! so please use `#[component]` instead!
|
2022-03-20 19:59:50 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2022-03-20 19:59:50 +00:00
|
|
|
fn Thing1<T>(cx: Scope, _a: T) -> Element {
|
|
|
|
cx.render(rsx! { "" })
|
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2022-03-20 19:59:50 +00:00
|
|
|
fn Thing2(cx: Scope, _a: u32) -> Element<'a> {
|
|
|
|
cx.render(rsx! { "" })
|
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2022-03-20 19:59:50 +00:00
|
|
|
fn Thing3<'a, T>(cx: Scope<'a>, _a: &'a T) -> Element<'a> {
|
|
|
|
cx.render(rsx! { "" })
|
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2022-03-20 19:59:50 +00:00
|
|
|
fn Thing4<'a>(cx: Scope<'a>, _a: &'a u32) -> Element<'a> {
|
|
|
|
cx.render(rsx! { "" })
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-09-15 14:13:36 +00:00
|
|
|
dioxus_desktop::launch(App);
|
2022-03-20 19:59:50 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
|
|
|
fn App(cx: Scope) -> Element {
|
2022-12-07 21:11:40 +00:00
|
|
|
let state = use_state(cx, || 1);
|
2022-03-20 19:59:50 +00:00
|
|
|
|
|
|
|
cx.render(rsx! {
|
|
|
|
div {
|
|
|
|
Thing1 { _a: 1 },
|
|
|
|
Thing2 { _a: 1 },
|
|
|
|
Thing3 { _a: state },
|
|
|
|
Thing4 { _a: state },
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|