React Moving Scroll
Getting Started
Introduction
Getting Started
✅ What is React Moving Scroll?
It's React Hook for making it easy to scroll to some specific contents that you wanna go. You can use it for Navigation Bar, Buttons, or anything you want, for adding smooth scrolling. It would help you as it give you the efficiently function, React Moving Scroll.
✅ Installation
React Moving Scroll is available as a package on npm.
npm i react-moving-scroll
Or if you are using yarn:
yarn add react-moving-scroll
Or if you are using pnpm:
pnpm add react-moving-scroll
✅ Getting Started
If you finished to install, then you could import useScroll in your project.
import { useScroll } from "scroll-moving";
export default function App() {
const { handleScroll, ref } = useScroll();
const list = ["Click Me 1", "Click Me 2" ];
return (
<div>
<div onClick={(event) => handleScroll(event, list)}>
<button>Click Me 1</button>
<button>Click Me 2</button>
</div>
<div ref={ref(0)} style={{ height: "100vh" }}>Content 1</div>
<div ref={ref(1)} style={{ height: "100vh" }}>Content 2</div>
</div>
);
}
Let's check Quick Start for more information that how to use.