Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 1 month ago
JSON representation

💾 Persist and rehydrate a Formik form to localStorage

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