From the course: React Practice for Beginners: Build and Modify Basic Components

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: Make a contact form

Solution: Make a contact form

- [Instructor] You were tasked with the challenge of creating a form for contacting customer support. What you had to do was implement the handleSubmit. And you had to create the input for name and the text area for the message and the name. And here you can see a possible solution. You can see that in my handleSubmit, I'm using the setters for updating the state. First, I'm updating the submitted messages, and then I'm resetting the name and the message to be cleared again. And in my return, I'm rendering the UI by having an input and a text area. The input is for the name, and it's connected to the state name. The text area is for the message, and it's connected to the message. On change, we update the states. Then, when we click the button, we handle the submit. So let's go ahead and test this code. As you can see, all our tests are passing. And that's it. That's how you could have solved this challenge.

Contents