@virtuoso.dev/reactive-engine-storage
v2.0.2
Published
Cell persistence in web storage and cookies for the Virtuoso reactive engine.
Readme
Reactive Engine Storage
@virtuoso.dev/reactive-engine-storage persists @virtuoso.dev/reactive-engine-core cells in localStorage, sessionStorage, or cookies. A storage link hydrates the cell on engine startup and writes changes back as the cell updates.
Installation
npm install @virtuoso.dev/reactive-engine-core @virtuoso.dev/reactive-engine-storageQuick Example
import { Cell } from '@virtuoso.dev/reactive-engine-core'
import { linkCellToStorage } from '@virtuoso.dev/reactive-engine-storage'
const theme$ = Cell<'light' | 'dark'>('light')
linkCellToStorage(theme$, {
key: 'app-theme',
storageType: 'localStorage',
})License
MIT
