Home

Awesome

React-size

Helpers to manage browser size changes in React.

Two Higher-Order Components are provided:

listenResize(Component,useCallback,useScroll,propName)

Listens to an element's own size changes through element-resize-detector.

listenWindowResize(component,useCallback,propName)

Listens to window resize events through jobj

Usage

npm install react-size
import React from 'react'
import {listenWindowResize} from 'react-size'

class MyComponent extends React.Component{
	render(){
		return (<div>{this.props.dim.width}</div>)
	}
}

export default listenWindowResize(MyComponent,false,'dim')

License

MIT