From the course: MERN Essential Training (2020)

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Finalize the form

Finalize the form

From the course: MERN Essential Training (2020)

Start my 1-month free trial

Finalize the form

- [Instructor] Now, let's finalize the code for the form by adding all the proper functions required and testing the application. Again, as a note, I've only added a few elements for the fields for our players but only to make sure you're not going to see me add all these elements on screen, which is repetitive. Feel free to add them yourselves on your application. Okay, so let's go back to the PlayerForm and now we're going to do the functions. So the first thing I'm going to do is remove the constructor, so we're not going to need the constructor, and I'm going to add the submitPlayer function that we need here. So submitPlayer, which will take an event, and then we're going to prevent the default behavior, which is basically refreshing the browser automatically, so we're preventing that, and then we'll use axios. So we need to import it here first, so let's go ahead and do that, so import axios from axios, and…

Contents