From the course: React: Using TypeScript (2019)

Unlock the full course today

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

Functional/stateless component syntax

Functional/stateless component syntax

From the course: React: Using TypeScript (2019)

Start my 1-month free trial

Functional/stateless component syntax

- [Instructor] So let's continue working on our functional component. So we're back into our class component here, and what I'd like to do is pass some props into my component here, and then leverage the TypeScript inspection to actually check my props to make sure that I get the right information and then pass it down here. So let's go back to our message component here, and let's add a prop first, so we'll a prop called message equals, and then we'll pass This is a simple, let's change it a little bit, so we did simple on here. This is a quick message, so we'll do This is a simple message, so we change it, and we know we actually have the right stuff, and then save it. So right now, we get an error because we don't have props in this particular component. So it says right now, we're not taking any props in this particular component. So let's make sure we do. So let's move back to our message, and now, this is where TypeScript is going to come into play. So what we've done here in…

Contents