Create stateful React Components using TypeScript

Share this video with your friends

Send Tweet

You can create stateful React Components in TypeScript by extending from the React.Component class. This parent class takes two generic parameters, Props and State.

This lessons shows these generic parameters and React.Component in action.

antmdvs
antmdvs
~ 7 years ago

Hi Basarat, thanks for this course. I noticed you are declaring props and state using type as opposed to interface. What is your guidance on using type vs interface for React props/state?

Basarat Ali Syed
Basarat Ali Syed(instructor)
~ 7 years ago

It deesn't matter in this case : https://basarat.gitbooks.io/typescript/docs/styleguide/styleguide.html#type-vs-interface 🌹