Skip to content

markcda/dioxus-v04-optional-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.fetch();
    if let Some(project_card) = get_project_card_fut.read_clone(false) {
        ...
    }
})

About

Optional futures for Dioxus 0.4.0-0.4.3

Topics

Resources

Stars

Watchers

Forks

Languages