sandiiarov / use-events

🍭 Event hooks
https://sandiiarov.github.io/use-events
492 stars 16 forks source link

Making useWindowResize safe for server-side render #167

Open jemeric opened 5 years ago

jemeric commented 5 years ago

When using this in an isomorphic app it will fail with an error "window is undefined" before the client-side even gets a chance to render. This patch allows the server-side to specify a width/height to gracefully handle such cases.