use-page-transition
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i use-page-transition

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

9.09 kB

Total Files

6

Last publish

Collaborators

  • charlesstover