1.0.4 • Published 3 years ago

@artifak/usematchmedia v1.0.4

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

@artifak/usematchmedia

A React hook that allows you to perform media queries within your React component.

Installation

Yarn

yarn add @artifak/usematchmedia

NPM

npm install @artifak/usematchmedia

Usage

import { useMatchMedia } from 'artifak';
import { ExampleMobile } from './ExampleMobile';
import { ExampleDesktop } from './ExampleDesktop';

export function Nav() {
  const matchedMobile = useMatchMedia('(hover: none)');

  return (
    <>
      {matchedMobile && <ExampleMobile />}
      {!matchedMobile && <ExampleDesktop />}
    </>
  );
}
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago