@react-hook/event
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "@react-hook/event", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/event#readme", | ||
@@ -5,0 +5,0 @@ "repository": "github:jaredLunde/react-hook", |
@@ -53,14 +53,17 @@ <hr> | ||
// Logs an event each time the `document` is clicked | ||
const DocumentComponent = () => { | ||
const target = useRef(null) | ||
const useLogDocumentClick = () => { | ||
useEvent(document, 'click', (event) => console.log(event)) | ||
return <div ref={target} /> | ||
} | ||
// Logs an event each time the `window` is clicked | ||
const WindowComponent = () => { | ||
const target = useRef(null) | ||
const useLogWindowClick = () => { | ||
useEvent(window, 'click', (event) => console.log(event)) | ||
return <div ref={target} /> | ||
} | ||
// Logs an event each time element#foo` is clicked | ||
const useLogElementClick = () => { | ||
useEvent(document.getElementById('foo'), 'click', (event) => | ||
console.log(event) | ||
) | ||
} | ||
``` | ||
@@ -67,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17923
94