Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-hook/event

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/event - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc