Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markcda/dioxus-v04-optional-hooks
Optional futures for Dioxus 0.4.0-0.4.3
https://github.com/markcda/dioxus-v04-optional-hooks
dioxus dioxus-desktop dioxus-web hooks
Last synced: 8 days ago
JSON representation
Optional futures for Dioxus 0.4.0-0.4.3
- Host: GitHub
- URL: https://github.com/markcda/dioxus-v04-optional-hooks
- Owner: markcda
- Created: 2024-05-28T22:38:23.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-11-04T07:43:28.000Z (2 months ago)
- Last Synced: 2024-12-20T19:11:34.215Z (22 days ago)
- Topics: dioxus, dioxus-desktop, dioxus-web, hooks
- Language: Rust
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dioxus-v04-optional-hooks
Simplifies future hooks that should be reusable.
## Usage
```rust,ignore
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) {
...
}
})
```