1.0.0 • Published 3 years ago

@ziphooks/use-scroll v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@ziphooks/use-scroll

React Hook for get current scroll position. It is useful when make animations.

Installation

yarn

yarn add @ziphooks/use-scroll

npm

npm i @ziphooks/use-scroll

Usage

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

function App() {
  const scrollPosition = useScroll();
  return (
      <div>
        <h1>X: {scrollPosition.x}</h1>
        <h1>Y: {scrollPosition.y}</h1>
      </div>
  );
};

Return

Return valueTypeDescription
stateObjectAn object that gives you scroll x position and scroll y position