@miyauci/react-click-outside
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published
    logo image

    npm version bundle size npm download npm type definitions Commitizen friendly Gitmoji semantic-release code style: prettier License: MIT

    @miyauci/react-click-outside

    🚚 Install

    npm i -s @miyauci/react-click-outside
    or
    yarn add @miyauci/react-click-outside

    💡 Usage

    This provides React Custom Hooks.

    import React, { useRef } from 'react'
    import { useClickOutside } from '@miyauci/react-click-outside'
    
    const App: FC = () => {
      const ref = useRef<HTMLElement>(null)
      const onClick = () => console.log('Outside clicked')
    
      useClickOutside(ref, onClick)
    
      return (
        <div>
          Outer
          <div ref={ref}>
            <div>Inter</div>
          </div>
        </div>
      )
    }

    💞 Related

    Install

    npm i @miyauci/react-click-outside

    DownloadsWeekly Downloads

    18

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    10.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • miyauci