Questions

Check whether all of that information about forms has stuck by answering the following questions:

  1. In our generic Form implementation, why did we make the onSubmit function prop asynchronous?
  2. When we implemented the generic Form and Field components, what was the purpose of the touched state?
  3. 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}
/>
  1. Why did we use the React context in our generic Form and Field implementations?
  2. Extend our generic Field component to include a number editor, using the native number input.
  3. Implement a validator in Form.tsx that will check that the field value is between two numbers.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.98.26