Latest
@react-hook/latest
A React hook that updates useRef().current with the most recent value each invocation
Testing
react
react component
use-ref
use-latest
use-effect-callback
useeffect callback
@react-hook/latest
Testing
javascript
npm
Stars
1
Weekly
0
Open issues
0
Bundle
~60 kB
Installation
npm install @react-hook/latestCode example
import { Latest } from "@react-hook/latest";
export function Example() {
return (
<div>
<h2>Latest</h2>
<Latest />
</div>
);
}Pros & cons
Pros
- Actively maintained by Jared Lunde
- 0 weekly downloads. Battle tested
- First-class TypeScript definitions
- MIT licensed
Considerations
- Adds roughly ~60 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 0 open issues on GitHub