npm.io
0.1.0 • Published 5 years ago

use-page-progress

Licence
MIT
Version
0.1.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
1

Version License minified + gzip size

use-page-progress

Using Starter useCustomHook: React Hook Starter by a super nice huy Colby Fayock!

Please sponsor his work!

How to use

Install

npm i use-page-progress
Examples

Get the percentage and create a progress bar

import React from "react";
import { usePageProgress } from "use-page-progress";

export default function Page() {
  const { scrollPercentage } = usePageProgress();
  return (
    <div>
      <div style={{ position: "fixed", top: 0, left: 0, width: `${scrollPercentage}%` }}></div>
      // Page content
    </div>
  );
}

Keywords