@nooks_seo/use-scroll
v1.0.0
Published
React Hook to track the current scroll position (x, y) of the window.
Readme
@nooks_seo/use-scroll
React Hook to track the current scroll position (x, y) of the window.
📦 설치
npm install @nooks_seo/use-scroll
# 또는
yarn add @nooks_seo/use-scroll사용 방법
import React from "react";
import { useScroll } from "@nooks_seo/use-scroll";
function App() {
const { x, y } = useScroll();
return (
<div style={{ height: "200vh", padding: "20px" }}>
<h1>Scroll Position</h1>
<p>X: {x}px</p>
<p>Y: {y}px</p>
</div>
);
}
export default App;