Created
November 4, 2021 01:28
-
-
Save mathias5r/c1acc4ca3a86da212c2b025307283794 to your computer and use it in GitHub Desktop.
generic component
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
| const MyList = <T extends unknown>({items, onItemSelected}: MyListProps<t>): JSX.Element => ( | |
| <FlatList | |
| data={items} | |
| renderItem={({item}: {item: MyListItemProps<T>}) => ( | |
| <TouchableOpacity onPress={() => onItemSelected(item)}> | |
| <Text>{item.text}</Text> | |
| </TouchableOpacity> | |
| )} | |
| /> | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tis mistyped inMyListProps<t>