Cart header right now getting data from child component to parent through functions and props (bottom to up). Use context to share data with Cartcounter component in the header.
Create a custom context provider component so that all the auth functions and states reside into it and then shared with the entire app component. This will be refactoring the code as well.
UseEffect() hook has a clean up function. At this time the app is running the setformIsValid() function on every keystroke, we can use the clean up function and make sure that instead of running it on every keystroke run it once when the input field is filled.
To achieve this we need to setup a time delay and make sure as soon as the next key is pressed the previous time delay gets cancelled. That way we can make sure that the function runs only once after the field is complete/filled.
Remove the default state of input boxes to be invalid. The validation should happen when the input element is in focus or when value changes. The default state should be plain.
Instead of using single state hook everytime you want to save the state of an element create single state object that takes multiple values as its properties.