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
-
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-use
hooks don't support SSR most of the time, whereasreact-hookz/web
seems 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.SSR
environment variable, so the users could remove it by assigningfalse
during the build time.EDIT:
@react-hookz/web
if the following text is replaced during the build-time with"object"
stringtypeof window
typeof navigator
typeof document
Beta Was this translation helpful? Give feedback.
All reactions