Permalink
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (26 sloc) 760 Bytes

WindowScrollSensor

FaCC that re-renders on window scroll.

Example

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

<WindowScrollSensor>{({x, y}) =>
  `x: ${x}, y: ${y}`
}</WindowScrollSensor>

You can also use it without children.

<WindowScrollSensor onChange={({x, y}) => console.log(x, y)} />

withWindowScroll() HOC

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

import {withWindowScroll} from 'libreact/lib/WindowScrollSensor';

@withWindowScroll decorator

React stateful component decorator that adds windowScroll prop.

import {withWindowScroll} from 'libreact/lib/WindowScrollSensor';

@withWindowScroll
class MyComp extends Component {

}