Frontend live coding · 40 minutes
Sign-up form with validation
Build a sign-up form in React in 40 minutes, with no form library. The fields are email, password, confirm password, and a checkbox to accept the terms. Validate the fields, submit to a fake async function that sometimes fails, and show pending, success and error states. The form must work with a keyboard and a screen reader. Explain your decisions while you code, as in a live round.
Requirements
- Rules: the email looks valid, the password has at least 8 characters, the confirmation matches, the terms box is checked
- An error appears after the user leaves a field or tries to submit, not on the first key press
- Each error is next to its field and linked with aria-describedby, and an invalid field has aria-invalid
- Submit calls an async function; while it runs, the button is disabled, shows a pending text, and a second submit is impossible
- Success shows a confirmation; a server error shows a message and keeps the entered values
- After a failed submit, focus moves to the first invalid field
- Every input has a visible label, the correct type and an autocomplete value
What reviewers look for
What reviewers look for, the checklist and the stretch goals opens with a year in the app. What a year includes