Hello…everyone. In this video I validated a simple login form consisted of email and password within the front end using useState hook and conditional rendering.

The simple idea is to save the values of inputs in a state then on form submit
we need to check both email and password states if they are empty…if yes then we need to populate the error states and show the user that error conditionally (if we have any error).

import ‘bootstrap/dist/css/bootstrap.css’; (put this in index.js)

email regex

const emailRegex = /^[a-zA-Z0-9.!#$%&'+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)$/;

Fragments - AERØHEAD https://soundcloud.com/aerohead​​​​
Creative Commons — Attribution-ShareAlike 3.0 Unported — CC BY-SA 3.0
Free Download / Stream: https://bit.ly/al-fragments​​​​
Music promoted by Audio Library https://youtu.be/O7PzeUTESAA

#react #usestate

React Login form Validations using UseState Hook and Conditional Rendering
1.70 GEEK