Socket
Socket
Sign inDemoInstall

formik-persist

Package Overview
Dependencies
17
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    formik-persist

Persist and rehydrate a Formik form


Version published
Weekly downloads
2.8K
decreased by-2.78%
Maintainers
1
Install size
163 kB
Created
Weekly downloads
 

Readme

Source

Formik 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 two 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.

Author

Todo

  • Alternative storages (localForage, sessionStorage)
  • Support AsyncStorage for React Native

Keywords

FAQs

Last updated on 30 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc