Jetha Lal is working on a new component for login, where he is supposed to do these basic validations.
- Username should be at least 5 characters long
- Password should be at least 8 characters long
- Button should be disabled if any of the above validation fails
Help him complete this component using
useEffect hook. Once the form is valid, the button should be enabled and on click of it, it should show an alert saying "Login Successful".
Hint 1: Apart from maintaining local state for
password, you may need to maintain a local state of the form validity. Hint 2: You need to use
onInputevent to update value of