Skip to content

Commit dde1066

Browse files
authored
fix: Usage (#309)
1 parent 2e037f0 commit dde1066

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,26 @@ open http://localhost:8000
3535
```js | pure
3636
import Form, { Field } from 'rc-field-form';
3737

38-
<Form
39-
onFinish={values => {
40-
console.log('Finish:', values);
41-
}}
42-
>
43-
<Field name="username">
44-
<Input placeholder="Username" />
45-
</Field>
46-
<Field name="password">
47-
<Input placeholder="Password" />
48-
</Field>
38+
const Input = ({ value = "", ...props }) => <input value={value} {...props} />;
4939

50-
<button>Submit</button>
51-
</Form>;
40+
const Demo = () => {
41+
return (
42+
<Form
43+
onFinish={(values) => {
44+
console.log("Finish:", values);
45+
}}
46+
>
47+
<Field name="username">
48+
<Input placeholder="Username" />
49+
</Field>
50+
<Field name="password">
51+
<Input placeholder="Password" />
52+
</Field>
53+
54+
<button>Submit</button>
55+
</Form>
56+
);
57+
};
5258

5359
export default Demo;
5460
```

0 commit comments

Comments
 (0)