use_window_width

Function use_window_width 

Source
pub fn use_window_width(cx: &ScopeState) -> &UseWindowWidth
Expand description

hooks for window’s width

§Arguments

returns: UseWindowWidth

§Examples

use dioxus::prelude::*;
use dioxus_use_window::use_window_width;

fn App(cx: Scope) -> Element {
    let width = use_window_width(&cx);

    cx.render(rsx!(
        h1 { "Window width: {width}" }
    ))
}