Skip to content

useSessionStorage ​

Category
Browser

Hook that manages session storage value

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

Usage ​

typescript
const [value, setValue, removeValue] = useSessionStorage('key', 'value');

Demo ​

Api ​

Parameters

NameTypeDefaultNote
keystring-The key of the storage
initialValue?UseStorageInitialValue<Value>-The initial value of the storage
options?UseStorageOptions<Value>-The options of the storage

Contributors ​

Source • Demo