typescript some props from object code example
Example 1: TYPESCript props class component
class Test extends Component<PropsType,StateType> {
constructor(props : PropsType){
super(props)
}
render(){
console.log(this.props)
return (
<p>this.props.whatever</p>
)
}
};
Example 2: get typescript props of component
type ViewProps = React.ComponentProps<typeof View>
// or
type InputProps = React.ComponentProps<'input'>