useRafState
Hook that returns the value and a function to set the value
state
low
test coverage
Last changed: 7 months ago
TIP
This hook uses requestAnimationFrame browser api to provide enhanced functionality. Make sure to check for compatibility with different browsers when using this api
Installation
Library
CLI
Manual
typescript
import { useRafState } from '@siberiacancode/reactuse';Usage
typescript
const [value, setValue] = useRafState(initialValue);Demo
Api
Type declaration
typescript
export type UseRafStateReturn<Value> = [Value, (value: Value) => void];Source
Source • DemoContributors
D