Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@AsaAyers
Created August 23, 2016 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AsaAyers/b2ade4a49b2277e0d7b2346c27229ba5 to your computer and use it in GitHub Desktop.
Save AsaAyers/b2ade4a49b2277e0d7b2346c27229ba5 to your computer and use it in GitHub Desktop.
// This was written using gists editor. I hope I have the syntax right.
function HOCAutoSizer(ChildComponent) {
return function(props) { // Stateless component
return (
<AutoSizer>
{({ height, width }) => (
<ChildComponent
width={width}
height={height}
{...props}
/>
)}
</AutoSizer>
)
}
}
const SizedScroll = HOCAutoSizer(VirtualScroll)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment