1.1.1 • Published 2 years ago

react-simple-clickout v1.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
2 years ago

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, { useState } from 'react'
import ClickOut from 'react-simple-clickout'

const Test = () => {
  const [active, setActive] = useState(false)

  return (
    <div>
      <h2>React Simple ClickOut</h2>
      <button onClick={() => setActive(true)}>Click-me</button>
      {active && (
        <ClickOut onClickOut={() => setActive(false)}>I`m visible</ClickOut>
      )}
    </div>
  )
}

export default Test
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>
    )
  }
}
1.1.1

2 years ago

1.1.0

3 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago