Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

react-simple-clickout

1.0.2 • Public • Published

React Simple ClickOut

npm install --save react-simple-clickout

Demo

React Simple ClickOut

How to use

Set your action function in onClickOut on the ClickOut component

Examples

import React from 'react'
import 'ClickOut' from 'react-simple-clickout'

class ReactSimpleClickOut extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
    	active: false
    }
  }
  
  onClickOut(){
    this.setState({ active: false })
  }
  
  render() {
    return (
      <div>
        <h2>React Simple ClickOut</h2>
        <button onClick={() => this.setState({active: true})}>Click-me</button>
        {this.state.active && (
          <ClickOut onClickOut={() => this.onClickOut()}>I`m visible</ClickOut>
        )}
      </div>
    )
  }
}

install

npm i react-simple-clickout

Downloadsweekly downloads

1

version

1.0.2

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability