GoogleChromeLabs / react-adaptive-hooks

Deliver experiences best suited to a user's device and network constraints
Apache License 2.0
5.1k stars 113 forks source link

[improvement] In useSaveData hook, instead of useState, useRef can be used #4

Closed itaditya closed 4 years ago

itaditya commented 4 years ago

useRef is much more suitable than useState when you just want some value to persist across renders. I can make a PR for that change.

itaditya commented 4 years ago

Saw PR https://github.com/GoogleChromeLabs/react-adaptive-hooks/pull/1 I guess that would be even better.

addyosmani commented 4 years ago

Thanks for the suggestion, @itaditya. We've just landed https://github.com/GoogleChromeLabs/react-adaptive-hooks/pull/1 and hopefully that's a sufficient solution.