useLocalForage
A useState
like hook that persists its value through localForage
in either
local storage or indexedDB.
It has a built in event listener that will ensure the value is updated in the DOM when the value changes. So no need to worry about using shared contexts. Update the value in one place, update it anywhere.
Usage
1 2 3 4 5 6 7
import useLocalForage from "@/hooks/use-local-forage"; export default function Example() { const [value, setValue] = useLocalForage("key", "value"); return <div>{value}</div>; }
Installation
1
npx shadcn add "https://registry.niels.foo/use-local-forage.json"