https://github.com/alexweblab/window-width-react-hook
This React hook returns the current window width.
https://github.com/alexweblab/window-width-react-hook
Last synced: 11 months ago
JSON representation
This React hook returns the current window width.
- Host: GitHub
- URL: https://github.com/alexweblab/window-width-react-hook
- Owner: AlexWebLab
- Created: 2021-05-12T07:37:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-13T06:33:22.000Z (over 4 years ago)
- Last Synced: 2025-03-09T02:33:03.625Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# About
This React hook returns the current window width.
## Install
```bash
npm i window-width-react-hook
```
Or
```bash
yarn add window-width-react-hook
```
## Usage
1. Include the hook:
```javascript
import useWindowWidth from 'window-width-react-hook';
```
2. Use it where is needed:
```jsx
function App() {
return (
Current width: {useWindowWidth()}px
);
}
```
### License
Licensed under the MIT License, Copyright © 2021 AlexWebLab