ScrollSensor

January 31, 2018 ยท View on GitHub

FaCC that re-renders on when scroll position in a DOM element changes.

Props

  • el - HTMLElement whose scrollTop and scrollLeft to track.

Example

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

<ScrollSensor el={element}>{({x, y}) =>
  `x: ${x}, y: ${y}`
}</ScrollSensor>