DEV Community

Discussion on: React PropTypes vs Typescript! Any experience?

Collapse
 
tschaka1904 profile image
Maximilian Koch

Thanks! I’m having a little struggle to make the difference between the Prop Types and TypeScript at the moment! 😅 But I think I catch up slowly 😅

Collapse
 
nickytonline profile image
Nick Taylor

TypeScript allows you to potentially statically type your whole JS codebase, whereas prop types are really just for validating the soundness of props passed into React components while running in development mode.

When you build for production and are using prop types, ensure to remove them. If you use Create React App, this is already handled for you, but if you have rolled your own config for webpack or another build system, you need to configure your build to remove them for production.