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 intro
From the course: React: Using TypeScript (2019)
Functional/stateless component intro
- [Teacher] If you have some experience with React, you know exactly what functional components are, but in this video, we'll start exploring how they work in relation to TypeScript, and then do some code that we'll finish in the next video. A functional component, at its core, is a Javascript function. Therefore, its syntax won't change much from a function where we return something. In this case, we return HTML to be rendered into our obligation. So how does TypeScript change this? Not that much. The only difference is that we define what are the types we pass into the function's arguments, and also the return type. In other words, we'll dig deeper into how to do functions in TypeScript while coding a component. Let's get started. So the first thing I'm going to do is create a brand new component, and I'm going to go into the Source folder, and then click on New File. And I'm going to call this one message.tsx so we keep the extension for TypeScript. And let's go ahead and create a…
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
-
-
-
-