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.
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?
It deesn't matter in this case : https://basarat.gitbooks.io/typescript/docs/styleguide/styleguide.html#type-vs-interface 🌹