rexxars / use-device-pixel-ratio

React hook for getting the device pixel ratio and reacting to changes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`useEffect` is run every time if there is an `options` object.

RunDevelopment opened this issue · comments

According to the examples in the docs, useDevicePixelRatio is supposed to be used with inline option objects.

Example:

const dpr = useDevicePixelRatio({maxDpr: 50})

However, this will cause the internal useEffect to run every time useDevicePixelRatio is called, so the deps array of useEffect is effectively useless (if an inline options object is used).

Fixed in 1.1.2 - thanks for reporting!