1.0.4 • Published 1 year ago

npm-use-localstorage v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

useLocalStorage - React Hook

useLocalStorage is a custom hook to get and set localstorage value.

Installation

# Using npm
npm i npm-use-localstorage

Usage

useLocalStorage return two value. 1. First is localStorage value. 2. Second is function which helps to update localStorage value.

# Import from npm-use-localstorage
import useLocalStorage from "npm-use-localstorage";
 
# In the hook you need to pass two parameter(key, value) 
const [isUserLoggedIn, getSetLocalStorage] = useLocalStorage("isLoggedIn", "true");

# If you want to get localstorage value then just pass key
const [isUserLoggedIn] = useLocalStorage("isLoggedIn");

#If you want to set localstorage value then use second paramter which is function
getSetLocalStorage("isLoggedIn", "false");
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago