Package Exports
- react-outside-click-handler
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-outside-click-handler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-outside-click-handler
React Component for handling some specific component outside click
Table of contents
- Installation
- API
<OutsideClickHandler onOutsideClick useCapture />
- Example
- Development
- Credits
Installation
yarn add react-outside-click-handlerAPI
<OutsideClickHandler onOutsideClick useCapture />
props
onOutsideClick(Function): outside click handleruseCapture(Boolean): See link's useCapture section
Example
class Example extends React.Component {
constructor(props) {
super(props);
this.handleOutsideClick = this.handleOutsideClick.bind(this);
}
handleOutsideClick() {
// ...
}
render() {
return (
<div>
<TodoList>
<Todo />
...
</TodoList>
<OutsideClickHandler onOutsideClick={this.handleOutsideClick}>
<InsideComponent />
</OutsideClickHandler>
</div>
);
}
}Development
yarn startThen, Go to http://localhost:3000
Credits
This component is inspired by airbnb/react-dates's OutsideClickHandler
Licence
MIT @ Taehwan, No (taehwanno)