Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 1.9 KB

README.md

File metadata and controls

70 lines (51 loc) · 1.9 KB

@mochiya98/react-infinite-lite

@mochiya98/react-infinite-lite gzip size license MIT

super lightweight alternative to react-infinite

Installation

npm i @mochiya98/react-infinite-lite

Usage

same as react-infinite
(easy migration from react-infinite)
see more details in seatgeek/react-infinite README

import Infinite from "@mochiya98/react-infinite-lite";
function App() {
  return (
    <Infinite containerHeight={100} elementHeight={30}>
      <div className="hoge">1</div>
      <div className="hoge">2</div>
      {/*...*/}
    </Infinite>
  );
}

CDN

<script
  src="https://unpkg.com/@mochiya98/react-infinite-lite"
  crossorigin="anonymous"
></script>
<!-- window.ReactInfiniteLite -->

<script type="text/babel">
  function App() {
    return <ReactInfiniteLite>{/*...*/}</ReactInfiniteLite>;
  }
</script>

Unsupported features

  • timeScrollStateLastsForAfterUserScrolls - can be implemented yourself by using handleScroll
  • useWindowAsScrollContainer - not implemented yet
  • displayBottomUpwards - not implemented yet
  • preloadBatchSize - simplified for performance(index%5)

Additional features

  • optionalHeader: ReactNode - add fixed header

Changelog

0.2.1 - 2020-07-05

  • add missing containerHeightScaleFactor
  • update types

0.2.0 - 2020-05-07

  • rewrite with hooks
  • add tests
  • fix elementHeight behavior