Join Emmanuel Henri for an in-depth discussion in this video Introduction to interface, part of React: Using TypeScript.
- [Instructor] Interfaces are a great way to define…how the shape of our data will look like…and the types associated with the properties.…Interfaces are only used by the compiler…to check for types and validate to make sure…we are using the proper types upon compiling.…There are no impact on the program except for the validation…we are passing the right values and the proper types.…So let's visit creating an interface for a props.…So the first thing I'm going to do is clean up what we've done…in the previous video, we don't need those.…You can keep them if you want,…but we are not going to need them.…
And then I'm going to pass another prop to my message here.…So I'm going to pass the prop name and then put a name here.…So let's put Manny and then save this here.…So we're going to get an error here because right now…our message component cannot accept a name property yet.…So that's what we're going to change.…So let's go back to our message component here,…so click on Message.tsx.…And the first thing we're going to do is make sure first…
- Basic and complex types
- Functional/stateless components
- Class/stateful components
- Interfaces with React and TypeScript
- Implementing higher-order components