Check whether all of that information about forms has stuck by answering the following questions:
- In our generic Form implementation, why did we make the onSubmit function prop asynchronous?
- When we implemented the generic Form and Field components, what was the purpose of the touched state?
- When we implement a form field as follows, why do we tie label to input using the htmlFor attribute?
<label htmlFor={name}>{label}</label>
<input
type="text"
id={name}
value={values[name] === undefined ? '' : values[name]}
onChange={handleChange}
onBlur={handleBlur}
/>
- Why did we use the React context in our generic Form and Field implementations?
- Extend our generic Field component to include a number editor, using the native number input.
- Implement a validator in Form.tsx that will check that the field value is between two numbers.