Permalink
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (26 sloc) 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 {

}