Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 774 Bytes

WindowSizeSensor.md

File metadata and controls

41 lines (26 loc) · 774 Bytes

WindowSizeSensor

FaCC that re-renders on window size change.

Example

import {WindowSizeSensor} from 'libreact/lib/WindowSizeSensor';

<WindowSizeSensor>{({width, height}) =>
  `width: ${width}, height: ${height}`
}</WindowSizeSensor>

You can use it without children.

<WindowSizeSensor onChange={({width, height}) => console.log(width, height)} />

withWindowSize() HOC

HOC that merges windowSize prop into enhanced component's props.

import {withWindowSize} from 'libreact/lib/WindowSizeSensor';

@withWindowSize decorator

React stateful component decorator that adds windowSize prop.

import {withWindowSize} from 'libreact/lib/WindowSizeSensor';

@withWindowSize
class MyComp extends Component {

}