how to define generics in functional component typescript code example
Example: typescript generic function
function firstElement<Type>(arr: Type[]): Type {
return arr[0];
}
// s is of type 'string'
const s = firstElement(["a", "b", "c"]);
// n is of type 'number'
const n = firstElement([1, 2, 3]);