Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpittman committed Sep 12, 2020
1 parent 8a1b7ba commit 01cf8f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ npm i use-dismiss #or yarn add use-dismiss

Import the hook:

```jsx
import React from "react"
```javascript
import { useState } from "react";
import useDismiss from "use-dismiss";
// or import { useClickAway, useEscape } from "use-dismiss" for just click away or escape listeners

export default () => {
const [modal, setModal] = React.useState(false);
const [modal, setModal] = useState(false);
const ref = useDismiss(() => setModal(false));

return (
<div className="container">
<button onClick={() => setModal(true)}>Show Modal</button>
{ modal ? <div ref={ref}>Modal Content</div> : null }
{modal ? <div ref={ref}>Modal Content</div> : null}
</div>
);
}
};
```

## 📄 API
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-dismiss",
"version": "1.0.1",
"version": "2.0.0",
"description": "React hook that triggers a callback when user clicks outside the element.",
"author": {
"name": "Brandon Pittman",
Expand Down

0 comments on commit 01cf8f5

Please sign in to comment.