Skip to content

Commit 573e414

Browse files
committed
Fixed bug infield warnings example
1 parent 83fac81 commit 573e414

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

examples/field-warnings/index.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
1-
import React from "react";
2-
import { render } from "react-dom";
3-
import Styles from "./Styles";
4-
import { WarningEngine } from "./warning-engine";
5-
import { Form, Field } from "react-final-form";
6-
import setFieldData from "final-form-set-field-data";
1+
import React from 'react'
2+
import { render } from 'react-dom'
3+
import Styles from './Styles'
4+
import { WarningEngine } from './warning-engine'
5+
import { Form, Field } from 'react-final-form'
6+
import setFieldData from 'final-form-set-field-data'
77

8-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
8+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
99

1010
const onSubmit = async values => {
11-
await sleep(300);
12-
window.alert(JSON.stringify(values, 0, 2));
13-
};
11+
await sleep(300)
12+
window.alert(JSON.stringify(values, 0, 2))
13+
}
1414

1515
const App = () => (
1616
<Styles>
17-
<h1><span role="img" aria-label="final form flag">
17+
<h1>
18+
<span role="img" aria-label="final form flag">
1819
🏁
19-
</span>{' '}React Final Form Example
20+
</span>{' '}
21+
React Final Form Example
2022
</h1>
2123
<h2>
22-
<span role="img" aria-label="final form flag">⚠️</span>
23-
{' '}Warnings{' '}
24-
<span role="img" aria-label="final form flag">⚠️</span>
24+
<span role="img" aria-label="final form flag">
25+
⚠️
26+
</span>{' '}
27+
Warnings{' '}
28+
<span role="img" aria-label="final form flag">
29+
⚠️
30+
</span>
2531
</h2>
2632
<a href="https://github.com/erikras/react-final-form#-react-final-form">
2733
Read Docs
2834
</a>
2935
<p>
3036
Warnings, in this example, are defined as: suggestions to the user, like
31-
validation errors, but that do not prevent submission. Note that the{" "}
37+
validation errors, but that do not prevent submission. Note that the{' '}
3238
<code>&lt;WarningEngine/&gt;</code> component must be at the bottom of the
3339
form to guarantee that all the fields have registered.
3440
</p>
@@ -37,8 +43,7 @@ const App = () => (
3743
mutators={{ setFieldData }}
3844
render={({
3945
handleSubmit,
40-
reset,
41-
form: { mutators },
46+
form: { mutators, reset },
4247
submitting,
4348
pristine,
4449
values
@@ -82,10 +87,10 @@ const App = () => (
8287
<pre>{JSON.stringify(values, 0, 2)}</pre>
8388
<WarningEngine mutators={mutators} />
8489
</form>
85-
);
90+
)
8691
}}
8792
/>
8893
</Styles>
89-
);
94+
)
9095

91-
render(<App />, document.getElementById("root"));
96+
render(<App />, document.getElementById('root'))

0 commit comments

Comments
 (0)