sericaia / use-article-progress

Utility hook to show progress made when reading an article

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useArticleProgress hook

Simple hook to get the progress (0-100%) when reading an article. Changes as the user scrolls the page.

Usage

export function ArticleProgress() {
  const { percentage } = useArticleProgress();

  return <div>{percentage}%</div>;
}

Project Example

Check an example of usage inside /example folder.

cd example
yarn
yarn start
# open localhost:1234

An example of an article component using the progress hook

About

Utility hook to show progress made when reading an article

License:MIT License


Languages

Language:TypeScript 84.8%Language:HTML 10.4%Language:CSS 4.8%