Add Props to VideoCard
Let’s start by adding props to VideoCard. The first step is to define the data types for the props in TypeScript. In TypeScript, interfaces fill the role of naming and defining these types, and are a powerful way of defining contracts within your code as well as contracts with code outside of your project. Let’s define an interface for the props.- Open
VideoCard.tsxand insert an interface that declares the types of the props, below the import statements.
- In the arrow function for VideoCard, destructure each field in the interface.
- Add
:IPropsto enforce the type of each field in the object.
- Replace the hard-coded values with their respective values.
VideoCard.tsx should look like this:
Pass Props to VideoCard
Now we need to update the Landing Screen to pass values to VideoCard.- Open
LandingScreen.tsx. - Pass in
title,description, andimgURLto the VideoCard component. Changetitleto “My Video”, anddescriptionto “My Video Description”, to make it easier to verify we are passing the props.
LandingScreen.tsx should look like this:
- Hit “play” or press “r” to reload the app if needed, and there is our video card with updated values!

New video card values

