final-form-persist
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

final-form-persist

Persist your final-form values into a storage

NPM JavaScript Style Guide

Install

npm install --save final-form-persist

or

yarn add final-form-persist

Usage

import { createForm } from 'final-form'
import { createPersistDecorator } from 'final-form-persist'
 
const form = createForm({ onSubmit })
 
const { persistDecorator, clear } = createPersistDecorator({
  name: 'myPersistKey'
  debounceTime500 // in ms
  whitelist['some', 'key']
  storagelocalStorage // this is the default
})
 
const undecorate = persistDecorator(form)
 
// Use form
 
// Remove the entry from the storage if you want
clear()
 
// Clean up
undecorate()

Example

Example build with react-final-form

API

createPersistDecorator

Creates a final form decorator.

createPersistDecorator = ({
  name: string
  debounceTime?: number
  whiteliststring[]
  storage?: Storage
}) => FinalFormPersistDecorator

type FinalFormPersistDecorator

{
  persistDecoratorDecorator
  clear: () => void
  isPersistedboolean
}

License

MIT © premieroctet

Readme

Keywords

none

Package Sidebar

Install

npm i final-form-persist

Weekly Downloads

315

Version

1.0.4

License

MIT

Unpacked Size

92.6 kB

Total Files

9

Last publish

Collaborators

  • qgrancher
  • regourdco
  • thibz
  • shinework
  • foyarash