How can I define a type for the renderItem
handler of a FlatList
in React Native?
That's how I'm currently handling it:
// Importing the generic type of the FlatList render item handlerimport { ListRenderItem } from "react-native";// Associating the type to the handler const renderItem: ListRenderItem<Bill> = useCallback(({ item }) => (<BillCard id={item.id} name={item.name} icon={item.icon}{...}return (<List data={bills} renderItem={renderItem} keyExtractor={(item) => String(item.id)} /> );
But unfortunately, that's not working, refer to the following errors: