dioxus-v04-optional-hooks

Crates.iodioxus-v04-optional-hooks
lib.rsdioxus-v04-optional-hooks
version0.3.0
created_at2024-05-28 22:41:17.369622+00
updated_at2024-11-04 07:45:21.84794+00
descriptionOptional futures for Dioxus 0.4.0-0.4.3
homepage
repositoryhttps://github.com/markcda/dioxus-v04-optional-hooks
max_upload_size
id1254891
size6,503
Klimenty Titov (markcda)

documentation

README

dioxus-v04-optional-hooks

Simplifies future hooks that should be reusable.

Usage

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) {
        ...
    }
})
Commit count: 17

cargo fmt