GoogleChromeLabs / react-adaptive-hooks

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

use constant hook #5

Closed jeetiss closed 4 years ago

jeetiss commented 4 years ago

useConstant is better way to use constants as a hook)

it's run ones, don't have invalidation and don't create logic for update value, it's size just 223B

I added use-constant as deps. Do you think will be better move it to repo?

googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

jeetiss commented 4 years ago

@googlebot I signed it!

googlebot commented 4 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

alireza-mh commented 4 years ago

Is this do the same thing as #1 ?

jeetiss commented 4 years ago

@alireza-mh yes

koester commented 4 years ago

I think #1 should be preferred over this solution. There is no need to add a dependency for this.

addyosmani commented 4 years ago

Thank you for proposing this change, @jeetiss. Appreciate it! I've chosen to opt for https://github.com/GoogleChromeLabs/react-adaptive-hooks/pull/1 which we just landed in favor of introducing the dependency for now. Cheers!