Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 746 Bytes

WindowWidthSensor.md

File metadata and controls

41 lines (26 loc) · 746 Bytes

WindowWidthSensor

FaCC that re-renders on window width change.

Example

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

<WindowWidthSensor>{({width}) =>
  `width: ${width}`
}</WindowWidthSensor>

You can use it without children.

<WindowWidthSensor onWidth={({width}) => console.log(width)} />

withWindowWidth() HOC

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

import {withWindowWidth} from 'libreact/lib/WindowWidthSensor';

@withWindowWidth decorator

React stateful component decorator that adds windowWidth prop.

import {withWindowWidth} from 'libreact/lib/WindowWidthSensor';

@withWindowWidth
class MyComp extends Component {

}