use-localstorage-reactdeprecated

A custom hook to save state to localstorage!

Usage no npm install needed!

<script type="module">
  import useLocalstorageReact from 'https://cdn.skypack.dev/use-localstorage-react';
</script>

README

use-localstorage-react

A custom hook to save state to localstorage!

Demo

Sandbox Demo

Usage

Import it

import useLocalStorage from 'use-localstorage-react'

Set key and initial value

const [count, setCount] = useLocalStorage(0, 'counter')

Reload to see that the value stays the same.