Nacho Printing Machine

    @charlietango/use-media
    TypeScript icon, indicating that this package has built-in type declarations

    1.6.0 • Public • Published

    useMedia

    Detect if the browser matches a media query.

    Checkout the Storybook demo.

    Installation

    yarn add @charlietango/use-media

    API

    const matches = useMedia(query)

    The query can either be a CSS media query, or an object with he media query properties.

    Example

    import React from 'react'
    import useMedia from '@charlietango/use-media'
    
    const Component = () => {
      const matches = useMedia({ minWidth: 768 })
      return <div>{matches}</div>
    }
    
    export default Component

    Keywords

    Install

    npm i @charlietango/use-media

    DownloadsWeekly Downloads

    180

    Version

    1.6.0

    License

    MIT

    Unpacked Size

    5.42 kB

    Total Files

    6

    Last publish

    Collaborators

    • thebuilder
    • frederik_bosch