Created a simple login form using React, Typescript and React Material UI featuring useReducer and useEffect hooks.
A detailed article on How to build a React Login Form with Typescript and React hooks
Created a simple login form using React, Typescript and React Material UI featuring useReducer and useEffect hooks.
A detailed article on How to build a React Login Form with Typescript and React hooks
Top comments (3)
I've found that when using multiple
useStatehooks, it becomes easier to move touseReducer, especially when conditions mutate multiple pieces of state. I thinkuseStatestill works well in your example, but once you build a more complex login (with 2FA, requiring a new user to set a new password, etc), it can get messy quickly.you can also refactor your from with concent, it is worth doing.
here is 2 demos:
js ver: codesandbox.io/s/concent-guide-xvcej
ts ver: codesandbox.io/s/concent-guide-ts-...
Sure, I will look into it.
Thanks