Type React components and hooks in TypeScript: props, state, events

11 steps · about 7 h 55 min · Intermediate

  1. TypeScript: Documentation - TypeScript for JavaScript Programmers (doc, typescriptlang.org, 15 min)

    Start with the official quick tour of primitives, interfaces and unions, which every React type builds on.

  2. TypeScript: Documentation - Everyday Types (doc, typescriptlang.org, 30 min)

    Covers inference, object types, unions and literal types, the building blocks of props and state types.

  3. Using TypeScript (doc, react.dev, 20 min)

    The official React page shows the setup, @types/react and the core hook examples.

  4. How to Use TypeScript with React (article, freeCodeCamp, 20 min)

    A beginner walk-through of .tsx files and several ways to declare prop types, to cement the basics.

  5. TypeScript in React - Full Tutorial (video, YouTube, 45 min)

    Watch typed components and useState built in a real project, so you see the pieces working together.

  6. React with TypeScript: Typing Props, State and Events (article, Coddy, 15 min)

    A focused page on the three topics, including useState with null and union types, and typed refs.

  7. TypeScript and React: Hooks (article, fettblog.eu (Stefan Baumgartner), 25 min)

    Goes through useState, useRef, useContext, useReducer and others with typing pitfalls like strict-mode null refs.

  8. TypeScript for React Developers: The Complete Practical Guide (article, DEV Community, 25 min)

    Shows typed form events (ChangeEvent, FormEvent) and warns against over-annotating when inference already works.

  9. React with TypeScript Tutorial (tutorial, Total TypeScript (Matt Pocock), 3 h)

    Free hands-on exercises on props, hooks and reading React's type definitions let you practise what you've read.

  10. react-typescript-tutorial (repo, GitHub (total-typescript), 1 h)

    Clone the exercise repo to work the problem and solution files locally, with tests that tell you when you're right.

  11. React TypeScript Cheatsheet (reference, typescript-cheatsheets (GitHub), 40 min)

    Keep this community reference for edge cases such as prop patterns, event type lists and context typing.