Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is <Debug /> ? #1151

Closed
scottc-netflix opened this issue Dec 3, 2018 · 1 comment
Closed

Where is <Debug /> ? #1151

scottc-netflix opened this issue Dec 3, 2018 · 1 comment

Comments

@scottc-netflix
Copy link

scottc-netflix commented Dec 3, 2018

🐛 Bug report

You mention <Debug /> in your video but it doesn't appear to exist in Formik and isn't documented. Share the love?

Looking at Formik 1.3.2 (latest)

@jaredpalmer
Copy link
Owner

jaredpalmer commented Dec 3, 2018

I just built that for the demo.

https://github.com/jaredpalmer/formik-alicante/blob/master/src/components/Debug.js

import React from 'react';
import { FormikConsumer } from 'formik';

export const Debug = () => (
  <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
Projects
None yet
Development

No branches or pull requests

2 participants