File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
-
2
-
3
1
<h1 align =" center " width =" 100% " >
4
2
Typed React form
5
3
</h1 >
13
11
<a href="https://bundlephobia.com/result?p=typed-react-form"><img alt="NPM Size" src="https://img.shields.io/bundlephobia/minzip/typed-react-form" /></a>
14
12
</p >
15
13
16
-
17
14
- ✔️ ** Completly type-checked** : make less errors, this library was built for Typescript. Supports nested objects/arrays.
18
15
- 🤔 ** Simple** : An intuitive, unclottered and easy to understand api. Well [ documented] ( https://codestix.github.io/typed-react-form/ ) too (+JSDoc).
19
16
- :fire : ** Fast** : only rerenders the fields that change. This allows you to create huge forms.
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ function MyForm() {
36
36
}
37
37
```
38
38
39
- <iframe src="https://codesandbox.io/embed/basic-typed-react-form-example-zz7uw?fontsize=14&hidenavigation=1&theme=dark"
39
+ <!-- < iframe src="https://codesandbox.io/embed/basic-typed-react-form-example-zz7uw?fontsize=14&hidenavigation=1&theme=dark"
40
40
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
41
41
title="basic typed-react-form example"
42
42
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
43
43
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
44
- > </iframe >
44
+ ></iframe> -->
45
45
46
46
### Creating the submit handler
47
47
@@ -56,14 +56,15 @@ function MyForm() {
56
56
const form = useForm ({ email: " " });
57
57
58
58
function submit() {
59
- // The form.handleSubmit validates the form before calling this function
59
+ // You don't have to use form.handleSubmit, it just validates
60
+ // your form before calling this function
60
61
console .log (" submit" , form .values );
61
62
}
62
63
63
- // Use the standard html form element, which exposes the onSubmit event.
64
+ // Use the standard html form element, which has the onSubmit event.
65
+ // Make sure to add type="submit" to your submit button
64
66
return (
65
67
<form onSubmit = { form .handleSubmit (submit )} >
66
- { /* Make sure to add type="submit" */ }
67
68
<button type = " submit" >Submit!</button >
68
69
</form >
69
70
);
You can’t perform that action at this time.
0 commit comments