ankeetmaini / react-infinite-scroll-component

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

Number 0 appears when finish loading message appears #377

Open bronzegod3 opened 1 year ago

bronzegod3 commented 1 year ago

Getting a 0 showing up on screen when no data is present

Code:

  <InfiniteScroll
          dataLength={0}
          next={this.fetchMoreData}
          hasMore={0}
          loader={<h4>Loading...</h4>}
          endMessage={
            <p style={{ textAlign: "center" }}>
              <b>Yay! You have seen it all</b>
            </p>
          }
        >
        </InfiniteScroll>

results in html :

<infiinite-scroller... >
"0"
  <p style={{ textAlign: "center" }}>
              <b>Yay! You have seen it all</b>
            </p>
</infinite-scroller>
AreebKhan619 commented 1 year ago

This is most likely happening because you're sending a number instead of a boolean. Have you tried changing it to hasMore=Boolean(0) or hasMore={false}?