1.0.1 • Published 4 years ago
@raytheist/use-local-storage v1.0.1
@raytheist/use-local-storage
A React hook that works like useState but persists via localStorage
Install
npm install --save @raytheist/use-local-storage
Usage
import React from 'react'
import useLocalStorage from '@raytheist/use-local-storage'
const Example = () => {
const [value, setValue] = useLocalStorage('storage-key', 0);
return (
<button onClick={() => setValue(value + 1)}>{value}</button>
)
}
License
MIT © rayhatfield