Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaredpalmer/formik-persist
💾 Persist and rehydrate a Formik form to localStorage
https://github.com/jaredpalmer/formik-persist
form formik forms react
Last synced: 18 days ago
JSON representation
💾 Persist and rehydrate a Formik form to localStorage
- Host: GitHub
- URL: https://github.com/jaredpalmer/formik-persist
- Owner: jaredpalmer
- License: mit
- Created: 2017-10-02T20:13:11.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-08T08:04:14.000Z (over 2 years ago)
- Last Synced: 2024-04-14T12:48:37.619Z (7 months ago)
- Topics: form, formik, forms, react
- Language: TypeScript
- Homepage:
- Size: 98.6 KB
- Stars: 375
- Watchers: 8
- Forks: 57
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Formik Persist
Persist and rehydrate a [Formik](https://github.com/jaredpalmer/formik) form.
```
npm install formik-persist --save
```# Basic Usage
Just import the `` component and put it inside any Formik form. It renders `null`!
```js
import React from 'react'
import { Formik, Field, Form } from 'formik'
import { Persist } from 'formik-persist'export const Signup = () =>
;
My Cool Persisted Form
console.log(values)}
initialValues={{ firstName: '', lastName: '', email: '' }}
render={props =>
Submit
}
/>
```### Props
Only three props!
- `name: string`: LocalStorage key to save form state to
- `debounce:? number`: Default is `300`. Number of ms to debounce the function that saves form state.
- `isSessionStorage:? boolean`: default is `false` . Send if you want Session storage inplace of Local storage## Author
- Jared Palmer [@jaredpalmer](https://twitter.com/jaredpalmer)
## Todo
- Alternative storages (localForage)
- Support AsyncStorage for React Native