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
related reading
- Useful Patterns by Use Case | React TypeScript Cheatsheetreact-typescript-cheatsheet.netlify.app
- Function Components | React TypeScript Cheatsheetreact-typescript-cheatsheet.netlify.app
- TypeScript: Documentation - Object Typestypescriptlang.org
- TypeScript: Documentation - The Basicstypescriptlang.org
- Build your own Reactpomb.us
- How Props Work in React – A Beginner's Guidefreecodecamp.org
- Tutorial: Tic-Tac-Toe – Reactreactjs.org
- You Might Not Need an Effect – Reactreact.dev
- Typescript utility types that you must know - DEV Communitydev.to
- React handbookdevouringdetails.com
- React graph viscrubier.github.io
- Tao of React - Software Design, Architecture & Best Practices | Alex Kondovalexkondov.com