Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 597 Bytes

File metadata and controls

22 lines (15 loc) · 597 Bytes

Reapex local storage plugin

Easily persist and restore data between state and local storage

image

import { App } from 'reapex'
import createLocalStoragePlugin from 'reapex-plugin-local-storage'

// 1. Initialize the plugin
const { plugin, persist } = createLocalStoragePlugin()
const app = new App()

// 2. register the plugin
app.plugin(plugin)

// 3. Simply wrap a `model` with `persist`
const UserModel = app.model('User', { name: '', age: 0 })
persist(UserModel)