This package is more of an experiment, if you need such hook, better look for alternatives.
React hook useWindowSize()
that returns Window's innerWidth
and innerHeight
properties, and initiates render when window is being resized.
It uses single "resize" listener and relies on WeakSet and WeakRef, so be sure you can use it.
Here is an example on CodeSandbox.