1.0.5 • Published 4 years ago

react-useclickoutside v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

What is it?

  • @react-click-outside is a very simple custom hook to handle clicks outside a component

How to use it?

  • To use it you just need to passe a node ref (or an array of refs) and a callback to be called when the click outisde any of those refs

Examples

import React, { useRef } from 'react'
import { dispatchSomeAction } from './myActions'
import useClickOutside from '@react-click-outside'

const SomeComponent = () => {
  const myRef = useRef(null)
  useClickOutside(myRef, () => dispatchSomeAction())

  return (
   <div ref={myRef}>
     Doing some stuff
    </div>
  )
}
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago