Now that we have our form ready, let's take the next logical step and figure out how to submit the data to our API.
The first thing we need to do is to add an onSubmit event handler to the form. The handler is specific to the registration form, and thus should be associated with RegistrationForm. The most obvious place to define it is as a class method. Update RegistrationForm to the following:
class RegistrationForm extends React.Component { handleRegistration = (event) => { event.preventDefault(); event.stopPropagation(); } render() { return ( <form onSubmit={this.handleRegistration}> <Input label="Email" type="email" /> <Input label="Password" type="password" /> <Button title="Register" /> </form> ) }}
this.handleRegistration ...