Skip to content

Instantly share code, notes, and snippets.

@janjakubnanista
Last active June 4, 2020 15:33
Show Gist options
  • Save janjakubnanista/061b63f20dcd4ce5f1a62778592c1c88 to your computer and use it in GitHub Desktop.
Save janjakubnanista/061b63f20dcd4ce5f1a62778592c1c88 to your computer and use it in GitHub Desktop.
// 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