ob-infinite-scroller

1.0.1 • Public • Published

react-infinite-scroller

image

Installation

npm i ob-infinite-scroller

OR

yarn add ob-infinite-scroller

you can run demo with npm start

How to use

import Scroller from 'ob-infinite-scroller'

const App = () => {
  const height = 400
  const itemHeight = 60
  const data = Array.from({ length: 1000 }).map((_, index) => index + 1)
  const itemCreater = index => (
    <p key={index} onClick={() => console.log(index)}>
      {index}
    </p>
  )

  return (
    <div className="wrap">
      <p>React Infinite Scroller Demo</p>
      <Scroller
        height={height}
        itemHeight={itemHeight}
        data={data}
        itemCreater={itemCreater}
      />
    </div>
  )
}

Props

Name Type Default Description
itemHeight number 0 item's height
height number 0 wrapper's height
data any[] [] your data array
itemCreater React.Component void generate items with data
rootId string - -
styles style object - -
className string - -

Package Sidebar

Install

npm i ob-infinite-scroller

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

1.05 MB

Total Files

14

Last publish

Collaborators

  • xfcf