Skip to content

Instantly share code, notes, and snippets.

@MuddyBootsCode
Created November 19, 2020 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MuddyBootsCode/0229c8a870ac52fb75189053f50d10c3 to your computer and use it in GitHub Desktop.
Save MuddyBootsCode/0229c8a870ac52fb75189053f50d10c3 to your computer and use it in GitHub Desktop.
import React from 'react';
import { FormikConsumer } from 'formik';
export const FormDebugger = () => (
<div
style={{
margin: '3rem 0',
borderRadius: 4,
background: '#f6f8fa',
boxShadow: '0 0 1px #eee inset',
}}
>
<div
style={{
textTransform: 'uppercase',
fontSize: 11,
borderTopLeftRadius: 4,
borderTopRightRadius: 4,
fontWeight: 500,
padding: '.5rem',
background: '#555',
color: '#fff',
letterSpacing: '1px',
}}
>
Formik State
</div>
<FormikConsumer>
{({ validationSchema, validate, onSubmit, ...rest }) => (
<pre
style={{
fontSize: '.65rem',
padding: '.25rem .5rem',
overflowX: 'scroll',
}}
>
{JSON.stringify(rest, null, 2)}
</pre>
)}
</FormikConsumer>
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment