formik-observer
v1.0.1
Published
[![npm](https://img.shields.io/npm/v/formik-observer.svg?style=flat-square)](https://www.npmjs.com/package/formik-observer) [![License: BSD 3-clause "New" or "Revised" License](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg?style=flat-squa
Downloads
137
Maintainers
Readme
formik-observer
Table of Contents
Install
yarn add formik-observer
npm install formik-observer
Usage
import React from 'react';
import { Formik, Field, Form } from 'formik';
import FormikObserver from 'formik-observer';
export const Signup = () => (
<div>
<h1>My Cool Persisted Form</h1>
<Formik
onSubmit={values => console.log(values)}
initialValues={{ firstName: '', lastName: '', email: '' }}
>
{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>
<FormikObserver
onChange={({ values }) => console.log('onchange', values)}
/>
</Form>
)}
</Formik>
</div>
);
License
BSD-3-Clause