UNPKG

@nanostores/persistent

Version:

A store for Nano Stores state manager to keep data in localStorage

33 lines (21 loc) 1.15 kB
# Nano Stores Persistent <img align="right" width="92" height="92" title="Nano Stores logo" src="https://nanostores.github.io/nanostores/logo.svg"> A smart store for [Nano Stores] state manager to keep data in `localStorage` and synchronize changes between browser tabs. * **Small.** from 281 bytes (minified and brotlied). Zero dependencies. It uses [Size Limit] to control size. * It has good **TypeScript**. * Framework agnostic. It supports SSR. `localStorage` can be switched to another storage. ```ts import { persistentAtom } from '@nanostores/persistent' export const locale = persistentAtom('locale', 'en') ``` [Nano Stores]: https://github.com/nanostores/nanostores [Size Limit]: https://github.com/ai/size-limit --- <img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=nanostores-persistent&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>. --- ## Docs Read full docs **[here](https://github.com/nanostores/persistent#readme)**.