Generic components in React

A typed list component should tell you what its render callback receives. Generic props are how a reusable component stays specific at each use.

Lesson 2.36m 47sIntermediate16.4k students

Chapters

6:47
  1. 0:00Introduction
  2. 0:47When You Need Generics
  3. 2:45How To Create A Generic Component

What this lesson covers

  • Type a component over the shape of its items
  • Keep render props and callbacks correctly typed
  • Forward refs without losing the generic parameter

This lesson sits in Generics, part of TypeScript for Application Developers. It assumes what came before it and leads directly into the next lesson in the module.

In this lesson you will

  • Type a component over the shape of its items
  • Keep render props and callbacks correctly typed
  • Forward refs without losing the generic parameter

Resources