ankeetmaini / react-infinite-scroll-component

An awesome Infinite Scroll component in react.
https://react-infinite-scroll-component.netlify.com/
MIT License
2.88k stars 323 forks source link

Loading outside in InfiniteScroll #365

Closed MasterProvider closed 11 months ago

MasterProvider commented 1 year ago

It is possible to set loading outside in InfiniteScroll any Idea?

const [loading,setLoading]=useState(false);

<InfiniteScroll
                          dataLength={}
                          next={}
                          hasMore={}
                          loader={()=>setLoading(prev)=>!prev)}
                        >
</InfiniteScroll>
{loading&(<p>loading..</p>)}