flâneur — a map of the web's best reading

Typing Component Props | React TypeScript Cheatsheets

react-typescript-cheatsheet.netlify.app · 1,094 words · saved by 1 readers

This is intended as a basic orientation and reference for React developers familiarizing with TypeScript.

On this page This is intended as a basic orientation and reference for React developers familiarizing with TypeScript. Basic Prop Types Examples ​ A list of TypeScript types you will likely use in a React+TypeScript app: type AppProps = { message : string ; count : number ; disabled : boolean ; /** array of a type! */ names : string [ ] ; /** string literals to specify exact string values, with a union type to join them together */ status : "waiting" | "success" ; /** an object with known properties (but could have more at runtime) */ obj : { id : string ; title : string ; } ; /** array of obj

Explore this link on the map →

related reading