@hoooks/use-scroll

1.0.1 • Public • Published

@hoooks/use-scroll

Get current X, Y coordinates of scroll

Installation

yarn

yarn add @hoooks/use-scroll

npm

npm i @hoooks/use-scroll

Usage

import React from "react";
import useScroll from "@hoooks/use-scroll";

export default function App() {
  const { x, y } = useScroll();
  return (
    <div style={{ width: "300vw", height: "300vh" }}>
      <div style={{ position: "fixed" }}>
        <h1>X: {x}</h1>
        <h1>Y: {y}</h1>
      </div>
    </div>
  );
}

Readme

Keywords

Package Sidebar

Install

npm i @hoooks/use-scroll

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

1.57 kB

Total Files

4

Last publish

Collaborators

  • aidenjung