0.1.0 ā€¢ Published 3 years ago

use-page-progress v0.1.0

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

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>
  );
}