0.1.0 ā¢ Published 3 years ago
use-page-progress v0.1.0
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>
);
}
0.1.0
3 years ago