@tushar152003/use-media-query

1.0.2 • Public • Published

@tushar152003/use-media-query

A React hook to detect screen size based on media queries.

Installation

Install the package via npm:

npm install @tushar152003/use-media-query

Usage

Here’s how to use the useMediaQuery hook in your React components:

import useMediaQuery from '@tushar152003/use-media-query';

const MyComponent = () => {
  const isMobile = useMediaQuery('(max-width: 768px)');

  return (
    <div>
      {isMobile ? 'You are on a mobile device' : 'You are on a larger screen'}
    </div>
  );
};

export default MyComponent;

Dependents (0)

Package Sidebar

Install

npm i @tushar152003/use-media-query

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

2.2 kB

Total Files

5

Last publish

Collaborators

  • tushar152003