final-form-persist
Persist your final-form values into a storage
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'
debounceTime: 500
whitelist: ['some', 'key']
storage: localStorage
})
const undecorate = persistDecorator(form)
clear()
undecorate()
Example
Example build with react-final-form
API
createPersistDecorator
Creates a final form decorator.
createPersistDecorator = ({
name: string
debounceTime?: number
whitelist: string[]
storage?: Storage
}) => FinalFormPersistDecorator
type FinalFormPersistDecorator
{
persistDecorator: Decorator
clear: () => void
isPersisted: boolean
}
License
MIT © premieroctet