mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-26 04:23:08 +00:00
73047fe956
This commit solves the memoization , properly memoizing properties that don't have any generic parameters. This is a rough heuristic to prevent non-static lifetimes from creeping into props and breaking our minual lifetime management. Props that have a generic parameter are opted-out of the `partialeq` requirement and props *without* lifetimes must implement partialeq. We're going to leave manual disabling of memoization for future work.
34 lines
834 B
Rust
34 lines
834 B
Rust
use dioxus_core as dioxus;
|
|
use dioxus_core::prelude::*;
|
|
use dioxus_web::WebsysRenderer;
|
|
|
|
fn main() {
|
|
wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
|
|
console_error_panic_hook::set_once();
|
|
|
|
log::info!("hello world");
|
|
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
|
|
}
|
|
|
|
static Example: FC<()> = |ctx| {
|
|
let nodes = (0..5).map(|f| {
|
|
rsx! {
|
|
li {"{f}"}
|
|
}
|
|
});
|
|
ctx.render(rsx! {
|
|
div {
|
|
span {
|
|
class: "px-2 py-1 flex w-36 mt-4 items-center text-xs rounded-md font-semibold text-yellow-500 bg-yellow-100"
|
|
"DUE DATE : 189 JUN"
|
|
}
|
|
p {
|
|
"these"
|
|
"are"
|
|
"text"
|
|
"nodes"
|
|
}
|
|
{nodes}
|
|
}
|
|
})
|
|
};
|