react-hook-scroll
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

React-Hook-Scroll · GitHub license npm version npm downloads

React-Hook-Scroll" is a scroll UI library that can be used in React projects.
It is designed to be compatible with both desktop and mobile environments.

Install

npm i react-hook-scroll

Example

1. VirtualScroll

import { useState } from "react";
import { VirtualScroll } from "react-hook-scroll";

function App() {
  const [selected, setSelected] = useState(null);

  return (
    <>
      <VirtualScroll list={[1, 2, 3, 4, 5]} onItemSelected={setSelected} />
    </>
  );
}

react-hook-scroll
The VirtualScroll component requires two required profiles.

  • list: need a list to let the user choose.
  • onItemSelected: The action to be taken with the item selected by the user is required.

2. ScrollToTop

import { ScrollToTop } from "react-hook-scroll";

return (
  <>
    <ScrollToTop>
      <SVG />
    </ScrollToTop>
  </>
);

ScrollToTop

Contributing

Development happens in the open on GitHub and we are grateful for contributions including bug fixes, improvements, and ideas.

License

React-Hook-Scroll is MIT licensed.

Package Sidebar

Install

npm i react-hook-scroll

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

16.4 kB

Total Files

29

Last publish

Collaborators

  • imb96