Skip to content

AshrafChitamba/window-observer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Window Observer

React window observer is a library build to facilitate the process of matching the media of your device and check the scroll direction for other purposes like showing the navbar accordingly.

Installation

 npm i react-window-observer

Usage

import { useScrollDirection, useWindowMedia } from "react-window-observer"

const MyComponent = () => {
  const direction = useScrollDirection();
  const isTrue = useWindowMedia(540); // It defaults to 640 if no parameter is given

  console.log(direction);
  console.log(isTrue)

  return <div>My Component</div>
};

export default MyComponent

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published