Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

Item of key extractor has type unknown - React Native

$
0
0

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:

enter image description hereenter image description here


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>