Crates.io | dioxus-v04-optional-hooks |
lib.rs | dioxus-v04-optional-hooks |
version | |
source | src |
created_at | 2024-05-28 22:41:17.369622 |
updated_at | 2024-11-04 07:45:21.84794 |
description | Optional futures for Dioxus 0.4.0-0.4.3 |
homepage | |
repository | https://github.com/markcda/dioxus-v04-optional-hooks |
max_upload_size | |
id | 1254891 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Simplifies future hooks that should be reusable.
use dioxus_v04_optional_hooks::{FutureHook, StartupGuard};
use dioxus::prelude::*;
...
let project_selected = use_state(cx, || 0);
let get_project_card_fut = FutureHook::new(cx, StartupGuard::Enable, (project_selected,), |(project_selected,)| async move {
get_project_info(*project_selected).await
});
...
cx.render({
get_project_card_fut.lazy_fetch();
if let Some(project_card) = get_project_card_fut.read_clone(false) {
...
}
})