react-window-size-hooks
React hooks to get the window size.
Install
npm
$ npm i react-window-size-hooks
yarn
$ yarn add react-window-size-hooks
Usage
;; const ShowWindowSize = { const width height = ; // do something};
use only the width or height
;; const ShowWindowSize = { const width = ; const height = ; // do something};
used in SSR
Set an arbitrary initial value. If not set, the size is 0.
;; const ShowWindowSize = { const width height = ; // do something};
FAQ
What is the interval between Throttling?
33ms. It's about 30FPS.
What are the characteristics of the react-window-size-hooks?
- Only one resize event is registered, even if used in multiple locations.
- Throttling is also done in one place, which is efficient.
- Supports TypeScript.
Contribution
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.