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

@react-hook/latest

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/latest - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "@react-hook/latest",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/latest#readme",

@@ -5,0 +5,0 @@ "repository": "github:jaredLunde/react-hook",

<hr>
<div align="center">
<h1 align="center">
@react-hook/latest
useLatest()
</h1>

@@ -37,3 +37,13 @@ </div>

```jsx harmony
import _ from '@react-hook/latest'
import useLatest from '@react-hook/latest'
const useEvent = (element, name, listener) => {
const latest = useLatest(listener)
React.useEffect(() => {
const listen = (e) => latest.current(e)
element.addEventListener(name, listen)
return () => element.removeEventListener(name, listen)
}, [latest])
}
```

@@ -43,7 +53,13 @@

### useLatest(value)
```ts
const useLatest: <T extends any>(current: T) => React.MutableRefObject<T>
```
### Props
| Prop | Type | Default | Required? | Description |
| ---- | ---- | ------- | --------- | ----------- |
| | | | | |
| Prop | Type | Required? | Description |
| ----- | --------------- | --------- | ------------------------- |
| value | `T extends any` | Yes | Any value you want stored |

@@ -50,0 +66,0 @@ ## LICENSE

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