Skip to content

quisido/use-page-transition

Repository files navigation

usePageTransition Tweet version minzipped size downloads build

Listen for page transition (visibility and persistence) events with a React hook.

Install

  • npm install use-page-transition or
  • yarn add use-page-transition

Use

function App() {
  const [isVisible, isPersistent] = usePageTransition();
  return (
    <p>
      The page is {isVisible ? 'visible' : 'hidden'}
      {isPersistent ? ' and persisted' : ''}.
    </p>
  );
}

Sponsor 💗

If you are a fan of this project, you may become a sponsor via GitHub's Sponsors Program.

About

React hook for listening to page visibility events

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published