GithubHelp home page GithubHelp logo

react-everscroll's Introduction

DEPRECATED

Please use something like react-virtualized for more efficient and supported features like this library provided

react-everscroll

Performant large lists and infinite scrolling in React.

Large Lists are problematic because the browser will render every dom element it is given, even if the element is hidden, consequently large lists in DOM will destroy browser performance. Everscroll solves this by rendering only a portion of your list at any given time, and recycling dom elements to render new list rows as you scroll.

Infinite Scrolling becomes trivial, simply add new data to the index prop. Everscroll will invoke onEndReached prop so you know when to query for more data.

Dependencies

Assumes use of Babel or similar tool for ES6 to 5 transpiling and JSX compilation Component also currently depends on Immutable and lodash though these could be removed with a little effort (pull request if interested)

Usage

function renderRow(ID){
  return <div className="row">{ID}</div>
}

<Everscroll
  rowIndex={this.state.index.toArray()} // an index of IDs to render
  renderCount={100} // how many rows to render at a time
  reverse={true} // Whether the beginning of the list be at the top of the container (false) or the bottom (true)
  onEndReached={this.loadPastMessages} // called when the end of the index is reached. Useful for infinite loading
  renderRowHandler={renderRow} // given an element of your index, return your rendered row
  backCap={<InfiniteLoadingSpinner />} // content will be placed at the end of your list
  frontCap={<LoadMoreButton />} // frontCap will be placed at the start of your list
  />

Yet Another . . .

There are a number of well made react infinite list components. While we have not tried them all, most have some limitations such as requiring fixed height rows, poor performance, or not having a "reverse" mode.

Everscroll seeks to address all of these issues with a small and intuitive api.

If you have a use case that is not covered by the current API, make a feature request!

react-everscroll's People

Contributors

gnoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

metricle hhaidar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.