use_device_pixel_ratio
Reactive window.devicePixelRatio
NOTE: there is no event listener for
window.devicePixelRatio
change. So this function uses the same mechanism as described in this example.
Demo
Usage
use leptos::prelude::*;
use leptos_use::use_device_pixel_ratio;
#[component]
fn Demo() -> impl IntoView {
let pixel_ratio = use_device_pixel_ratio();
view! { }
}
Server-Side Rendering
On the server this function returns a Signal that is always 1.0
.
Feature
This function is only available if the crate feature
use_device_pixel_ratio
is enabled