use_window_size
Reactive window size.
Demo
Usage
use leptos::*;
use leptos_use::{use_window_size, UseWindowSizeReturn};
#[component]
fn Demo() -> impl IntoView {
let UseWindowSizeReturn { width, height } = use_window_size();
view! { }
}
Server-Side Rendering
On the server the width and height are always initial_size
which defaults to
Size { width: INFINITY, height: INFINITY }
.
Feature
This function is only available if the crate feature
use_window_size
is enabled