Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 359 Bytes

20-form-submission.md

File metadata and controls

16 lines (12 loc) · 359 Bytes

Form Submission

To change the behavior of the form, we need to add an event handler to the submit button.

The event handler will prevent the default behavior of the button, and log the values of the inputs.

<button onClick={handleSubmit}>Add</button>
function handleSubmit(event) {
  event.preventDefault();
  console.log(name);
}