react typescript props definition code example
Example 1: TYPESCript props class component
class Test extends Component {
constructor(props : PropsType){
super(props)
}
render(){
console.log(this.props)
return (
this.props.whatever
)
}
};
Example 2: ts react props type
type Props = {
size: string;
}
const Component = ({ size = 'medium' }: Props) => (
);