Submitting the form is the final part of the form implementation. The consumer of the Form component will handle the actual submission, which will probably result in a call to a web API. Our Form component will simply call a function in the consumer code when the form is submitted.
Form submission
Adding a submit button to the form
In this section, we are going to add a submit button to our Form component:
- Let's add a submit button to the Form JSX, wrapped in a div container within form-group:
<FormContext.Provider value={context}>
<form className="form" noValidate={true}>
{this.props.children}
<div className="form-group">
<button type="submit">Submit...