frinyvonnick / react-simple-infinite-loading

A list that infinitely loads content as user scrolls down in React
https://www.npmjs.com/package/react-simple-infinite-loading
Apache License 2.0
59 stars 13 forks source link

Add a placeholder property #18

Closed frinyvonnick closed 5 years ago

frinyvonnick commented 5 years ago

We should add the possibility to display a placeholder component if the data isn't loaded yet.

src/index.js line 47

{({ index, style }) => (
  <div style={style}>
-  {children[index]}
+  {children[index] || placeholder}
  </div>
)}

We should verify if children[index] exists otherwise we display a placeholder component passed as prop by the user.

trybick commented 5 years ago

I can try this!