@mochiya98/react-infinite-lite
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

@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

Package Sidebar

Install

npm i @mochiya98/react-infinite-lite

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

56.4 kB

Total Files

13

Last publish

Collaborators

  • mochiya98