Тёмный

React Forms With Validation Using Hooks - React Javascript 

LetsCode
Подписаться 2,9 тыс.
Просмотров 24 тыс.
50% 1

How to create a reusable Input component in react that will handle its own validation locally. How to set up these validation rules, so that you can add your own unique validation rules if necessary. Initally setting up three basic rules, required, max and min. I show you how to render error messages unique to that input field and prevent form submission until all fields are valid.
Github: github.com/dar...

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 30   
@olegvino5673
@olegvino5673 3 года назад
why is it SO complicated to add some basic validation.....
@letscode7478
@letscode7478 3 года назад
React doesn't have much built in support for forms, but what's good is that once you built it once you can reuse it quite easily
@chandrikabiswal4036
@chandrikabiswal4036 3 года назад
Could you help me,how could i navigate to another page after successfull validation ?
@masis-dk
@masis-dk 3 года назад
Really well explained !
@letscode7478
@letscode7478 3 года назад
Thanks!
@klin-coders9374
@klin-coders9374 4 года назад
there is no repo in the description
@eldorhusanov7082
@eldorhusanov7082 3 года назад
thanks turned out well
@dimutel
@dimutel 4 года назад
I'm trying to find the same guide but with multi step login form, first enter Username, then push Next button and go to next page to put the Password
@letscode7478
@letscode7478 4 года назад
Not something I can address in a comment, would need to do a video on it. Im sure if you did some digging around on youtube or stack overflow you would find some useful information that should help you.
@rochim9478
@rochim9478 4 года назад
what is the name of font?
@letscode7478
@letscode7478 4 года назад
Dank Mono is the font of the code
@laturchasanket6901
@laturchasanket6901 4 года назад
Your pronunciation is not that great, but trust me, you did explain it very well. Keep up with the good stuff you are putting online. Good Content!
@letscode7478
@letscode7478 4 года назад
Thanks for the feedback :D
@MayankGupta303
@MayankGupta303 4 года назад
cant able to hear you properly. anyways nice tuts
@letscode7478
@letscode7478 4 года назад
Thanks, I'm not the best when it comes to audio but trying to improve that!
@mauroinde
@mauroinde 4 года назад
Hey, Is it possible to use Yup, or any react validator for a Form. Without using Formik. I prefer managing my local state with useState. How can I do it?
@letscode7478
@letscode7478 4 года назад
Its defiantly possible to use Yup, but if your using Yup I would suggest using Formik with it, since Formik can take care of some of the work for you. If for some reason your completely against using Formik, then you would have to apply the Yup validation schema on submit. But I strongly recommend using Formik since it takes care of a lot of things like managing touched fields, storing error messages for you and handling state
@mauroinde
@mauroinde 4 года назад
@@letscode7478 thank you, I will use it, you are totally right
@abessesmahi4888
@abessesmahi4888 4 года назад
Awesome, thank you so much. Subscribed
@letscode7478
@letscode7478 4 года назад
Thanks, really means a lot, any feedback would be great :D
@chudasamavivekk7017
@chudasamavivekk7017 4 года назад
Awesome work. Which font family are you using in vs code ?
@letscode7478
@letscode7478 4 года назад
Thanks, im using the Dank Mono font.
@eldorhusanov7082
@eldorhusanov7082 3 года назад
Greetings from Uzbekistan
@klin-coders9374
@klin-coders9374 4 года назад
can we get the code?
@letscode7478
@letscode7478 4 года назад
Here is the code github.com/daryanka/form-validation
@klin-coders9374
@klin-coders9374 4 года назад
@@letscode7478 TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at validateString (internal/validators.js:120:11) at Object.join (path.js:375:7) at noopServiceWorkerMiddleware (C:\Users\OBC\Desktop\cargo ode_modules eact-dev-utils oopServiceWorkerMiddleware.js:14:26) at Layer.handle [as handle_request] (C:\Users\OBC\Desktop\cargo ode_modules\express\lib outer\layer.js:95:5) at trim_prefix (C:\Users\OBC\Desktop\cargo ode_modules\express\lib outer\index.js:317:13) at C:\Users\OBC\Desktop\cargo ode_modules\express\lib outer\index.js:284:7 at Function.process_params (C:\Users\OBC\Desktop\cargo ode_modules\express\lib outer\index.js:335:12) at next (C:\Users\OBC\Desktop\cargo ode_modules\express\lib outer\index.js:275:10) at launchEditorMiddleware (C:\Users\OBC\Desktop\cargo ode_modules eact-dev-utils\errorOverlayMiddleware.js:20:7) at Layer.handle [as handle_request] (C:\Users\OBC\Desktop\cargo ode_modules\express\lib outer\layer.js:95:5)
@klin-coders9374
@klin-coders9374 4 года назад
@@letscode7478 i get this error on running the code after npm install
@letscode7478
@letscode7478 4 года назад
@@klin-coders9374 Thanks for letting me know, it turned out to be an issue with react scripts. I also removed the service worker just in case. I've pushed the changes, you can either clone again or just change the react-scripts version in your package.json to 3.4.1, remove the service worker from the index.js file and run npm install again. Hope that fixes your issue.
@shashiverma3152
@shashiverma3152 4 года назад
is it the right approach to using ref ?
@letscode7478
@letscode7478 4 года назад
Since the validation is within the input component and we have to call a function inside that component it one approach to doing so. With the validation method in this video I do think the refs is the simplest way to go about it.
Далее
Why Signals Are Better Than React Hooks
16:30
Просмотров 478 тыс.
React Form Validation Tutorial
50:37
Просмотров 181 тыс.
React VS Svelte...10 Examples
8:35
Просмотров 563 тыс.
Learn useRef in 11 Minutes
10:20
Просмотров 640 тыс.
React Admin Crash Course
31:26
Просмотров 299 тыс.
React.js Hooks Crash Course
1:02:54
Просмотров 317 тыс.