/
Debug.js
42 lines (41 loc) 路 914 Bytes
/
Debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
import { FormikConsumer } from 'formik';
export const Debug = () => (
<div
style={{
margin: '3rem 1rem',
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: '.85rem',
padding: '.25rem .5rem',
overflowX: 'scroll',
}}
>
{JSON.stringify(rest, null, 2)}
</pre>
)}
</FormikConsumer>
</div>
);