useDevicePixelRatio
useDevicePixelRatio
is a hook that returns the device pixel ratio of the screen.
Usage
Live Editor
function Demo() { const { pixelRatio } = useDevicePixelRatio(); return <p>Device pixel ratio: {pixelRatio}</p>; }
Result
Loading...
API
UseDevicePixelRatio
Returns
UseDevicePixelRatioReturn
Arguments
UseDevicePixelRatioReturn
Property | Description | Type | DefaultValue |
---|---|---|---|
pixelRatio | Pixel ratio | number (Required) | - |