Size comparison with react-use #123
o-alexandrov
started this conversation in
Ideas
Replies: 1 comment 12 replies
-
|
And its not🙃 The reason is difference in features and optimisations. I think i can squeeze some bytes from the files, but it wont be a drastic change. |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you compare react-hookz/web with react-use on BundlePhobia (click the library names to open BundlePhobia).
Then, if you look at individual imports, you will see the majority of hooks increased in size, some of them are twice bigger in this library.
I haven't analyzed the reasons, but one possibility is:
react-usehooks don't support SSR most of the time, whereasreact-hookz/webseems to attempt to support SSRFor most of the users, supporting SSR is actually useless (because they don't do server-side rendering) and, therefore, harmful based on this library's increased size.
Please consider to come up with a way to have an ability to remove SSR support with dead code removal:
process.env.SSRenvironment variable, so the users could remove it by assigningfalseduring the build time.EDIT:
@react-hookz/webif the following text is replaced during the build-time with"object"stringtypeof windowtypeof navigatortypeof documentBeta Was this translation helpful? Give feedback.
All reactions