2.1.2 • Published 8 years ago
local-preferences v2.1.2
Methods
localPreferences.set(key, value)
Sets value in localStorage. set key to null
to clear the entry.
import {set} from "local-preferences"
set("isLoggedIn", true)
set("userId", 123)
set("email", "foo@bar.baz")
set("object", {
foo: {
bar: "baz"
}
})
localPreferences.get(key, fallback)
Retrieves value from localStorage.
import {get} from "local-preferences"
get("isLoggedIn") // => true
get("userId") // => 123
get("email") // => "foo@bar.baz"
get("object") // => {foo: {bar: "baz"}}
get("unset", "foo") // => "foo"
localPreferences.clear()
Passthrough to the native localStorage.clear()