Skip to content

A React hook that works like useState but persists using localStorage

License

Notifications You must be signed in to change notification settings

rayhatfield/use-local-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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

About

A React hook that works like useState but persists using localStorage

Resources

License

Stars

Watchers

Forks

Packages

No packages published