Generic Components with TS and React
summary
A concrete example builds a selectable list component that accepts items of varying shapes by making props generic and constraining them to a minimal shape (uses T extends SelectItem so each item has an id). The demo wires it to vegetable and Game of Thrones datasets, adds icons, sees type errors in .tsx when using arrow generic components, and fixes them by either converting the arrow to a function or adding the extends constraint so the component works.
AI-written summary · about
related talks
18mTypeScript Patterns For Better React Components
37mBuilding Better Components — A Journey to a More Resilient Frontend
28mBuilding Considerate React Component APIs with TypeScript
49mTypescript + React
26mUnleashing the Power of Duck-Typing in React: Crafting a Generic Application
15mTypeScript Patterns for Better React Components
23mTypeScript + React = ❤️
42mTypeScript Patterns for Better React Components
