Sébastien Rigaux

Type a polymorphic as prop in a React component

View resource

christianvm.dev

This tutorial builds an as prop that changes the rendered HTML element while preserving valid property types. TypeScript generics help prevent attributes from leaking between different tags.

Type a polymorphic as prop in a React component