react-use-window-sizes
Advanced tools
Comparing version 1.0.0 to 1.0.1
import { useState, useLayoutEffect } from "react"; | ||
const useWindowSize = () => { | ||
const useWindowSizes = () => { | ||
const [windowSize, setWindowSize] = useState({ width: 0, height: 0 }); | ||
@@ -20,2 +20,2 @@ | ||
export { useWindowSize }; | ||
export { useWindowSizes }; |
{ | ||
"name": "react-use-window-sizes", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A lightweight package to easily track window size in React.js", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/hxf31891/react-use-window-size.git" | ||
"url": "git+https://github.com/hxf31891/react-use-window-sizes.git" | ||
}, | ||
@@ -34,5 +34,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/hxf31891/react-use-window-size/issues" | ||
"url": "https://github.com/hxf31891/react-use-window-sizes/issues" | ||
}, | ||
"homepage": "https://github.com/hxf31891/react-use-window-size#readme", | ||
"homepage": "https://github.com/hxf31891/react-use-window-sizes#readme", | ||
"publishConfig": { | ||
@@ -39,0 +39,0 @@ "@hxf31891:registry": "https://npm.pkg.github.com" |
@@ -1,2 +0,19 @@ | ||
# react-use-window-size | ||
A lightweight package to easily track window size in React.js | ||
# useWindowSizes - a custom React hook | ||
A lightweight package to easily track window width & height in React.js | ||
Comes in handy for responsize design and animations | ||
## Install | ||
`npm install react-use-window-sizes` | ||
## Example | ||
```js | ||
import React from 'react' | ||
import { useWindowSizes } from 'react-use-window-sizes' | ||
function MyApp() { | ||
const { width, height } = useWindowSizes(); | ||
console.log('width:', width, 'height:', height) | ||
} | ||
``` |
3642
20