Skip to content

Commit de5eea5

Browse files
committed
Update blog
1 parent 2403fe4 commit de5eea5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Release v2.0.0
3+
authors: xuan
4+
---
5+
6+
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

Comments
 (0)