Function use_scrolling

Source
pub fn use_scrolling<'hook>(node: NodeRef) -> impl 'hook + Hook<Output = bool>
Expand description

A sensor hook that tracks whether HTML element is scrolling.

§Example

use yew_hooks::prelude::*;

#[function_component(UseScrolling)]
fn scrolling() -> Html {
    let node = use_node_ref();
    let state = use_scrolling(node.clone());
    
    html! {
        <div ref={node}>
            <b>{ " Scrolling: " }</b>
            { state }
        </div>
    }
}

§Note

When used in function components and hooks, this hook is equivalent to:

pub fn use_scrolling(node: NodeRef) -> bool {
    /* implementation omitted */
}