I\'m using React.js with TypeScript. Is there any way to create React components that inherit from other components but have some additional props/states?
What I\'m
import { Component } from 'react'
abstract class TestComponent extends Component
{
abstract test(): string
}
type Props = {
first: string,
last: string,
}
type State = {
fullName: string,
}
class MyTest extends TestComponent {
constructor(props: Props) {
super(props)
this.state = {
fullName: `${props.first} ${props.last}`
}
}
test() {
const { fullName } = this.state
return fullName
}
}