The useForm Hook!

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!

--

--

--

Excited @FlatironSchool Student

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Git on the Command Line — Improving the Experience

How are industries solving challenges using Ansible ?

What’s new in one.network version e2.13.0?

ECS deployment strategies: reduce downtime and risk with Blue/Green Deployment.

Making Sense of Multiple Monads

Creating your own OpenFaas Connector

How to Be a “Maker” — Even in the Enterprise

DataStax’s Snowflake Sink Connector for Apache Pulsar

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Emmanuel Amon

Emmanuel Amon

Excited @FlatironSchool Student

More from Medium

Cyclists Can Reduce High Blood Pressure by Adding Meditation to Their Daily Routine

My personal experience of ‘Nicotine’ addiction.

No BS Talk with a Jazz Bar Atmosphere

Unshattered’s Kelly Lyndgaard: From IBM to Recovery Advocate