At the moment, the title and content text for our Confirm component is hardcoded. Let's change these to reference properties (props) that the component takes in.
- First, we need to define a TypeScript type for our props. We'll use an interface for this preceding the Confirm class in Confirm.tsx:
interface IProps { title: string; content: string;}
- We can then reference the IProps type in angle brackets, after we reference React.Component in the class definition:
class Confirm extends React.Component<IProps>
React.Component is what is called a generic class. Generic classes allow types used within the class to be passed in. In our case, we have passed in our IProps interface. Don't worry if this doesn't make too much sense ...