Crate dioxus_hooks
source ·Expand description
§Dioxus Hooks
Website | Guides | API Docs | Chat
§Overview
dioxus-hooks
includes some basic useful hooks for dioxus:
- use_state
- use_ref
- use_future
- use_coroutine
- use_callback
Unlike React, none of these hooks are foundational since they all build off the primitive cx.use_hook
.
This crate also provides a few helpful macros to get around some Rust lifetime management issues in async.
to_owned![]
use_future()
use_callback!()
§Contributing
- Report issues on our issue tracker.
- Join the discord and ask questions!
§License
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Dioxus by you shall be licensed as MIT without any additional terms or conditions.
Macros§
- A helper macro for using hooks and properties in async environments.
Structs§
- The receiving end of an unbounded mpsc channel.
- The transmission end of an unbounded mpsc channel.
- This callback is not generic over a return type so you can hold a bunch of callbacks at once
Enums§
- A signal that represents the state of a future
- A signal that represents the state of a future
Traits§
- A dependency is a trait that can be used to determine if a effect or selector should be re-run.
- A dependency is a trait that can be used to determine if a effect or selector should be re-run.
Functions§
- Consume some context in the tree, providing a sharable handle to the value
- A callback that’s always current
- Consume some context in the tree, providing a sharable handle to the value
- Provide some context via the tree and return a reference to it
- Maintain a handle over a future that can be paused, resumed, and canceled.
- Get a handle to a coroutine higher in the tree
- Create a new effect. The effect will be run immediately and whenever any signal it reads changes. The signal will be owned by the current component and will be dropped when the component is dropped.
- A hook that allows you to spawn a future
- A hook that uses before/after lifecycle hooks to determine if the hook was run
- Creates a new Selector that may be sync. The selector will be run immediately and whenever any signal it reads changes.
- Creates a new Selector that may be sync with some local dependencies. The selector will be run immediately and whenever any signal it reads or any dependencies it tracks changes
- Creates a new unsync Selector. The selector will be run immediately and whenever any signal it reads changes.
- Creates a new unsync Selector with some local dependencies. The selector will be run immediately and whenever any signal it reads or any dependencies it tracks changes
- use_on_unmountDeprecated
- A memo that resolve to a value asynchronously.
- Creates a new Signal. Signals are a Copy state management solution with automatic dependency tracking.
- Creates a new `Send + Sync`` Signal. Signals are a Copy state management solution with automatic dependency tracking.