Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 760 Bytes

WindowScrollSensor.md

File metadata and controls

42 lines (26 loc) · 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 {

}