Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

infinite scroll for chat react js

<div
  id="scrollableDiv"
  style={{
    height: 300,
    overflow: 'auto',
    display: 'flex',
    flexDirection: 'column-reverse',
  }}
>
  {/*Put the scroll bar always on the bottom*/}
  <InfiniteScroll
    dataLength={this.state.items.length}
    next={this.fetchMoreData}
    style={{ display: 'flex', flexDirection: 'column-reverse' }} //To put endMessage and loader to the top.
    inverse={true} //
    hasMore={true}
    loader={<h4>Loading...</h4>}
    scrollableTarget="scrollableDiv"
  >
    {this.state.items.map((_, index) => (
      <div style={style} key={index}>
        div - #{index}
      </div>
    ))}
  </InfiniteScroll>
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: sortable jquery 
Javascript :: nested include sequelize 
Javascript :: countdown js 
Javascript :: xmlhttprequest status codes 
Javascript :: react typescript set type 
Javascript :: javascript question mark 
Javascript :: react-data-table-component cell action 
Javascript :: lodash round 
Javascript :: javascript shift 
Javascript :: js filter method in python 
Javascript :: appearing datepicker behind the modal 
Javascript :: download pdf 
Javascript :: electron js web reference to use node 
Javascript :: angular object sort by key 
Javascript :: js run command in terminal 
Javascript :: react js big calendar 
Javascript :: format iso time in human readable format with moment js 
Javascript :: js number padding to number of characters 
Javascript :: ping discord with autocode 
Javascript :: javascript not equal 
Javascript :: copy on clip board 
Javascript :: react : calling APIs after render 
Javascript :: array sort numbers 
Javascript :: Toasting a message 
Javascript :: aos animation 
Javascript :: alternative to setinterval 
Javascript :: navigation prompt javascript 
Javascript :: angular create injectable 
Javascript :: Math max with array js 
Javascript :: how to get data from for loop in react native 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =