Last active
June 4, 2020 15:33
-
-
Save janjakubnanista/061b63f20dcd4ce5f1a62778592c1c88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attempt 1: Add generic props to React.FC type | |
// | |
// TypeScript will not allow a const to be generic like this! | |
export const Select: React.FC<SelectProps<T>> = props => { | |
// Oh no! | |
} | |
// Attempt 2: Make the component function generic | |
// | |
// JSX parser will colide with TypeScript when trying to do something like this | |
// and the code will not compile since <T> looks like a JSX tag! | |
export const Select = <T>(props: SelectProps<T>) => { | |
// Oh no! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment