Coder Social home page Coder Social logo

react-infinite-scroll's Introduction

react-infinite-scroll npm version

npm i @srph/react-infinite-scroll

A simple infinite scroll React.js component.

Why

  • I was a bit frustrated with the existing libraries, so I went to come up with a simpler API.
  • I'd like to keep this library simple -- if you're looking for more advanced features and performant implementations, please check react-virtualized and react-infinity.

Usage

<Infinite callback={this.request} disabled={this.state.loading}>
  {this.state.items((item, i) =>
  	<div key={i}>{item.name}</div>
  )}
</Infinite>

API

Prop Description Type
callback The callback to be ran when we reach the offset function (required)
disabled Flag to run callback once we reach the offset boolean (default: false)
offset Allowance before reaching the offset number (default: 250)
container Flag if we're using the window (false) or this div (requires to be scrollable) boolean (default: false)
reverse Trigger callback when we reach the top instead of the bottom. Useful for chat applications. boolean (default: false)

Examples

You can check the demo, or build it yourself:

npm run install
npm run example:run

react-infinite-scroll's People

Contributors

srph avatar

Stargazers

Brian Bodollo avatar Danil avatar

Watchers

James Cloos avatar  avatar

Forkers

neohub

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.