From the course: Building React and ASP.NET Core Applications

Unlock the full course today

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

Designing the Create page

Designing the Create page

From the course: Building React and ASP.NET Core Applications

Start my 1-month free trial

Designing the Create page

- [Instructor] Now, let's create a new component which we are going to use to add new trips to our trips list. For that, let's go to visual code. In here, go inside the ClientApp, then Source, Components, Trip. In here, create a new file named Create.jsx. To create a component, we need to import the React and the Component from React library. Then next, we'll just write in here export class, create, which extends the component base class. In here, let us create a constructor where we are going to pass the parameter props, then, we'll just write in here, super(props). Now, for the create view we are going to have a form where we will have four fields. We are going to use these fields to send an object to our API end point. So, let us create the initial state of these fields. For that, we just write this.state, and then this is equal to, this state will have a name property, which is defaulted to just an empty string,…

Contents