This is unreleased documentation for Yew Next version.
For up-to-date documentation, see the latest version on

Trait yew::functional::Hook

source ·
pub trait Hook {
    type Output;

    // Required method
    fn run(self, ctx: &mut HookContext) -> Self::Output;
Expand description

A trait that is implemented on hooks.

Hooks are defined via the #[hook] macro. It provides rewrites to hook invocations and ensures that hooks can only be called at the top-level of a function component or a hook. Please refer to its documentation on how to implement hooks.

Required Associated Types§


type Output

The return type when a hook is run.

Required Methods§


fn run(self, ctx: &mut HookContext) -> Self::Output

Runs the hook inside current state, returns output upon completion.