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
From the course: React: Using TypeScript (2019)
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Introduction to TypeScript with React2m 17s
-
(Locked)
Basic types4m 22s
-
(Locked)
Other complex types4m 53s
-
(Locked)
Functional/stateless component intro2m 23s
-
(Locked)
Functional/stateless component syntax3m 37s
-
(Locked)
Class/stateful component intro1m 59s
-
(Locked)
Class/stateful component syntax3m 42s
-
-
-
-