1.0.2 • Published 6 years ago

click-outside-react v1.0.2

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

npm version

click-outside-react

Installation

npm install --save click-outside-react

Usage

import React, { Component } from 'react'
import { ClickOutside } from 'click-outside-react'

export default class Demo extends Component {
    state = {
        isPopupVisible: false
    }

    showPopup = () => {
        this.setState({ isPopupVisible: true })
    }

    hidePopup = () => {
        this.setState({ isPopupVisible: false })
    }

    render() {
        const { isPopupVisible } = this.state

        return (
            <div>
                {isPopupVisible
                    ? <ClickOutside onClickOutside={this.hidePopup}>Popup Content</ClickOutside>
                    : null
                }
            </div>
        )
    }
}

TODO

  • d.ts file
  • tests coverage
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago