Proyectos
Ver en GitHub
jaredpalmer/formik-persist
Acerca de
💾 Persist and rehydrate a Formik form to localStorage
Desarrollo web y de aplicacionesCrecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
OriginalFormik Persist
Persist and rehydrate a Formik form.
npm install formik-persist --save
Basic Usage
Just import the <Persist > component and put it inside any Formik form. It renders null!
import React from 'react'
import { Formik, Field, Form } from 'formik'
import { Persist } from 'formik-persist'
export const Signup = () =>
<div>
<h1>My Cool Persisted Form</h1>
<Formik
onSubmit={values => console.log(values)}
initialValues={{ firstName: '', lastName: '', email: '' }}
render={props =>
<Form className="whatever">
<Field name="firstName" placeholder="First Name" />
<Field name="lastName" placeholder="Last Name" />
<Field name="email" type="email" placeholder="Email Address" />
<button type="submit">Submit</button>
<Persist name="signup-form" />
</Form>}
/>
</div>;
Props
Only three props!
name: string: LocalStorage key to save form state todebounce:? number: Default is300. Number of ms to debounce the function that saves form state.isSessionStorage:? boolean: default isfalse. Send if you want Session storage inplace of Local storage
Author
- Jared Palmer @jaredpalmer
Todo
- Alternative storages (localForage)
- Support AsyncStorage for React Native
Explorar proyectos relacionados
Cargando…