Skip to content

useRafState ​

Hook that returns the value and a function to set the value

state
test coverage
Last changed: 2 days ago

Installation ​

Library
CLI
Manual
typescript
import { useRafState } from '@siberiacancode/reactuse';

Usage ​

typescript
const [value, setValue] = useRafState(initialValue);

Demo ​

Api ​

Parameters

NameTypeDefaultNote
initialValueValue-The initial value

Returns

UseRafStateReturn<Value>

Type declaration ​

typescript
export type UseRafStateReturn<Value> = [Value, (value: Value) => void];

Source ​

Source • Demo

Contributors ​

D
debabin
debabin

Released under the MIT License.