Class/stateful component syntax

- [Narrator] Now that we clearly understand…what a class is and how it would be used…in programming or React, let's revisit…our class component and then add some code to our class.…So let's go back to Visuals to do to do code…and then open app.tsx and the first thing we're going to do…is pass a type to our component.…So the way you do this in a component is by…using the arrows, so left and right arrow,…and then pass the type any or this would work as well.…So any would expect anything…and this would expect an object type.…

So what I'm going to do for now,…I'm going to do any.…And again, as we discussed in the previous video,…we are extended the component from React.…So this one way to writing the syntax…and we could do this…this way as well.…So we could remove all this and then simply do…react.component and this is exactly the same syntax.…So I'm going to go back to what I'm used to.…Feel free to keep the other syntax if you want to…and because we're using class call component,…with it comes life cycles.…

So let's explore two of them.…

Resume Transcript Auto-Scroll

Author

Released

2/5/2019

TypeScript offers developers a more structured approach to JavaScript application development, and is a natural fit for the build processes most React developers are already using. Combining the component approach in React with the discipline of TypeScript enables you to build clean web applications that will be easier to maintain over time. In this course, instructor Emmanuel Henri explains shows how to use TypeScript with React. He starts with a review of basic and complex types and functional and stateful components. Then he shows how to use TypeScript interfaces to improve your React code. Finally, learn how to implement higher-order components to reuse components while adding new functionality.