Created
August 11, 2022 20:55
-
-
Save cdaz5/2047fcbee29e37e45cdcfd9f21fc3f86 to your computer and use it in GitHub Desktop.
basic signature of a TypeScript component that accepts a generic
This file contains hidden or 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
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