You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I created this package, I didn't know that React has a convenient api called `React.Children.map`. As a result, I used `props.Item` and `props.itemData` to render the children of `InfiniteScroll`. To be honest, this approach made this package not intuitive.
7
+
8
+
After I learned `React.Children.map`, this api can make this package more intuitive and more easy to use. As a result, I deleted `props.Item` and `props.itemData` from `InfiniteScroll`, and used `React.Children.map` and `React.cloneElement` to pass reference to the child that should be observed.
9
+
10
+
Now you can use `InfiniteScroll` like other component, just pass the items to its children, it will call the `next` function when the observed child shows up in the viewport.
0 commit comments