infinite scroll react code example

Example 1: react-infinite-scroller

npm install react-infinite-scroller --save

Example 2: react-infinite-scroller

npm install --save react-infinite-scroll-component

  or

  yarn add react-infinite-scroll-component

  // in code ES6
  import InfiniteScroll from 'react-infinite-scroll-component';
  // or commonjs
  var InfiniteScroll = require('react-infinite-scroll-component');

Example 3: page is loading from previous page scroll in reactjs

//this piece of code will resolve this issue. in Reactjs.
componentDidMount() {
  window.scrollTo(0, 0)
}

Tags:

Misc Example