Skip to content

useDefault ​

Category
Utilities

Hook that returns the default value

typescript
import { useDefault } from '@siberiacancode/reactuse';

Usage ​

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

Demo ​

Api ​

Parameters

NameTypeDefaultNote
initialValueValue-The initial value
defaultValueValue-The default value

Contributors ​

Source • Demo