React Prop Types vs Typescript React Prop Types vs Typescript reactjs reactjs

React Prop Types vs Typescript


Sounds about right. When you use TypeScript you can define the props via an interface.

interface ButtonProps {  text: string,  shadow?: boolean}const Button: React.FunctionComponent<ButtonProps> = props => {  return ( /* [...] */ );};

See here


I think you don't need prop types if you use typewriting. Typescript is a good solution for strong typing, but for this you need to write more code. Props Types provide you efficient typization and small code blocks for you classes or functional components