@hookeasy/use-scroll

1.0.2 • Public • Published

@hookeasy/use-scroll

React Hook to update your scroll event

install

npm i @hookeasy/use-scroll

or

yarn add @hookeasy/use-scroll

example

import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom";
import useScroll from "@hookeasy/use-scroll";

function App() {
  const { y } = useScroll();

  return (
    <div className="App" style={{ height: "1000vh" }}>
      <h1 style={{ position: "fixed", color: y > 100 ? "red" : "black" }}>
        Hello CodeSandbox
      </h1>
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Readme

Keywords

Package Sidebar

Install

npm i @hookeasy/use-scroll

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

2.68 kB

Total Files

5

Last publish

Collaborators

  • baram