Handling Generics in JSX

Understand the different options for using generics in JSX code.

Handling generics in JSX code can seem strange at first. We may see compiler warnings that we don't expect. However, there are two ways to correctly represent generic parameters in JSX.

Adding multiple generics

Adding a comma after a generic declaration is the TypeScript syntax for declaring multiple generics.

Once we do this within JSX code, the TypeScript compiler clearly understands our intent and the errors disappear.

Here's how it works:

Get hands-on with 1200+ tech skills courses.