From e3398b8571f03e4b4bab0092d2483ddbe3f1a015 Mon Sep 17 00:00:00 2001 From: Nicco Date: Sat, 28 Sep 2019 19:16:45 +0200 Subject: [PATCH] Update README.md --- README.md | 104 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 05f6527..9845837 100644 --- a/README.md +++ b/README.md @@ -59,44 +59,44 @@ const Form = () => { ```typescript const Form = () => { - const { auto, form, errors } = useForm({ - username: '', - email: '', - password: '' - }, { - username: value => value.length > 3, - email: { - validator: /@/, - message: 'Must contain an @', - }, - password: [ - { - validator: /[A-Z]/, - message: 'Must contain an uppercase letter' - }, - { - validator: /[\d]/, - message: 'Must contain a digit' - }, - ] - }) + const { auto, form, errors } = useForm({ + username: '', + email: '', + password: '' + }, { + username: value => value.length > 3, + email: { + validator: /@/, + message: 'Must contain an @', + }, + password: [ + { + validator: /[A-Z]/, + message: 'Must contain an uppercase letter' + }, + { + validator: /[\d]/, + message: 'Must contain a digit' + }, + ] + }) - return ( -
+ return ( + -

Errors & Validation

+

Errors & Validation

- - {errors.username && 'Must be longer than 3'} + + {errors.username && 'Must be longer than 3'} - - {errors.email} + + {errors.email} - - {errors.password} + + {errors.password} -
- ) + + ) } ``` @@ -107,31 +107,31 @@ Often it happens that you use a specific input or framework, so the default gett ```typescript const Form = () => { - const { auto, form, errors } = useForm({ - awesome: true, - }) + const { auto, form, errors } = useForm({ + awesome: true, + }) - return ( -
{ - e.preventDefault() - console.log(form) - }}> + return ( + { + e.preventDefault() + console.log(form) + }}> -

Custom

+

Custom

- + - + -
- ) + + ) } ```