react-window-observer
TypeScript icon, indicating that this package has built-in type declarations

1.2.11 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i react-window-observer

Weekly Downloads

1

Version

1.2.11

License

MIT

Unpacked Size

22.8 kB

Total Files

18

Last publish

Collaborators

  • ashrafchitambaa