Skip to content

Instantly share code, notes, and snippets.

@cdaz5
Created August 11, 2022 20:55
Show Gist options
  • Save cdaz5/2047fcbee29e37e45cdcfd9f21fc3f86 to your computer and use it in GitHub Desktop.
Save cdaz5/2047fcbee29e37e45cdcfd9f21fc3f86 to your computer and use it in GitHub Desktop.
basic signature of a TypeScript component that accepts a generic
interface DropdownProps<TOption> {
options: ReadonlyArray<TOption>;
onSelection: (option: TOption) => void;
}
function Dropdown<TOption> ({ options, onSelection }: DropdownProps<TOption>) {
return (
// implementation skipped for article clarity
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment