DEV Community

Discussion on: Use TypeScript Generics to enhance your React components and make them reusable

Collapse
 
ayrbox profile image
ayrbox

I agree with you that typescript gives more benefit but at the time if writing GenericComponent data type is still unknonwn and at line 14 you are assuming that value is of type string. Besides saying that your technique is extremely use full if you are passing rendering list as child function. You can pass the data into rendering function where you will have all goodness of typescript (intellisense, compile time check and so on).

Hope its clear, let me know if you need an example.

Thread Thread
 
nitsancohen770 profile image
Nitsan Cohen

I am not sure I fully understood, please share your example. Thanks!