react-scroll-position
ScrollPosition HOC which remembers attached node scroll position and restores it.
Installation
npm install --save react-scroll-position
Usage
const RememberMyScroll = <ScrollPosition scrollKey="my-scroll"> <div ref=attachScrollNode> children </div> </ScrollPosition>
ScrollPosition HOC uses children as function and returns functions which can be used to manipulate the scrolling.
attachScrollNode
Expects HTMLElement node
.
getScroll
Gets attached node
x and y scroll positions.
getScrollNode
Gets attached HTMLElement node
.
setScroll
Sets attached node
x and y scroll positions.