Tools to help you with screen resizing.
yarn add react-resize-tools
# or
npm i react-resize-tools --save
https://github.com/Achaak/react-resize-tools/blob/master/CHANGELOG.md
Return innerWidth, innerHeight, outerWidth and outerHeight when screen is resized.
Example:
const size = useScreenSize()
Return xl, sm, md, lg, xl or xxl when screen is resized.
Example:
const widthType = useScreenWidthType()
// or
const widthType = useScreenWidthType({
sm: 640,
md: 768,
lg: 1024,
xl: 1280,
xxl: 1400
})
Option | Default |
---|---|
sm | 640 |
md | 768 |
lg | 1024 |
xl | 1280 |
xxl | 1400 |
Return outerHeight when the page is scrolled.
Example:
const scroll = useScroll()