Crate dioxus_hooks

source ·
Expand description

§Dioxus Hooks

Crates.io MIT licensed Build Status Discord chat

Website | Guides | API Docs | Chat

§Overview

dioxus-hooks includes some basic useful hooks for dioxus such as:

  • use_signal
  • use_effect
  • use_resource
  • use_memo
  • use_coroutine

Unlike React, none of these hooks are foundational since they all build off the primitive use_hook.

§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 cloning multiple values at once
  • A helper macro for use_reactive that merges uses the closure syntax to elaborate the dependency array

Structs§

Enums§

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 Analagous to use_context_provider and use_context, but used for coroutines specifically See the docs for use_coroutine for more details.
  • use_effect will subscribe to any changes in the signal values it captures effects will always run after first mount and then whenever the signal values change If the use_effect call was skipped due to an early return, the effect will no longer activate.
  • A hook that allows you to spawn a future. This future will not run on the server The future is spawned on the next call to wait_for_next_render which means that it will not run on the server. To run a future on the server, you should use spawn directly. use_future won’t return a value. If you want to return a value from a future, use use_resource instead.
  • A hook that uses before/after lifecycle hooks to determine if the hook was run
  • Creates a new Memo. The memo will be run immediately and whenever any signal it reads changes.
  • use_on_unmountDeprecated
  • Takes some non-reactive data, and a closure and returns a closure that will subscribe to that non-reactive data as if it were reactive.
  • A memo that resolves to a value asynchronously. Similar to use_future but use_resource returns a value. See Resource for more details.
  • 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.