The useForm Hook!

Emmanuel Amon
2 min readSep 2, 2021

Prior to me last couple of projects, I have been using the standard react form accompanied with the useState management which I enjoyed and have been very useful! The problem came when I started to use external api with request limits. I would use the onChange method which would constantly render after each click. You can see how this can rack up a large amount of request throughout the duration of a project. In set the useForm hook! I am sure there are ways to get past this with my previous method but what I found in the useForm hook caught my attention. It solved the main issue of constant rendering because you do not need the onChange method with this hook. This is designed to only render once you submit the form! This can cut the number of api request by a fraction.

Recently I have been working with validations on the back end with Ruby on Rails. One thing that I was having trouble with was preventing a user from moving on to the next screen if they didn’t fill in all the required sections. In step useForm again! Using the formState method that was built in, I was able to have 2 sources of validation for required user inputs. One using Rails validations and one using useForm!

--

--