captivationsoftware / react-sticky

<Sticky /> component for awesome React apps
MIT License
2.64k stars 386 forks source link

Support for React Hooks #280

Open jEnbuska opened 5 years ago

jEnbuska commented 5 years ago

Would it be technically possible for this library to support hooks?

Example usage:

const MyStickyComponent = () => {   
   const {ref, style} = useSticky({top: 0, left: 0});
   return (
      <div ref={ref} style={style}>
         {/* ... */}
      </div>
   )
}
vcarl commented 5 years ago

This would be a dramatically new API, it's possible on a technical level but it'd be a significant change. There would still need to be a StickyContainer somewhere in the render tree, as well.