Greeting Form

Easy
Free
#Forms and Inputs

Build a greeting form in React: type a name, click Say hello, and the page greets that name. You'll practice handling a form's submit event with onSubmit, and keeping the name being typed separate from the name that was submitted. The starter has the page's form, with the Name field and the Say hello button.

Requirements

  • There's no greeting until the form is submitted: typing in the Name field doesn't show one.
  • Submitting the form greets the name in the field: "Hello, Ada!" for Ada. The greeting comes from the form's onSubmit, which runs both for a click on Say hello and for Enter in the field.
  • After that, the greeting changes only when the form is submitted again. Typing a different name leaves it as it is until then.
  • Submitting the form doesn't reload the page.

React docs

Concepts you'll practice