Documentation
State
useLocalStorage

useLocalStorage

useLocalStorage hook that allows you to use the browser's local storage as a state.

Demo

First Name: Aung Myat

Last Name: Moe

Range: 0

Usage

import {useLocalStorage} from "@reactusehooks/core";
 
const [user, setUser] = useLocalStorage('name', {
        firstName: 'Aung Myat',
        lastName: 'Moe',
});
 
// change user firstName and lastName from local storage
setUser({
        firstName: 'Aung',
        lastName: 'Myat',
});