I am working on a react native app. I am currently using Item component to display data in flatlist. But editor gives me an error for the second parameter of React.memo like below.
Type 'boolean | undefined' is not assignable to type 'boolean'.
Type 'undefined' is not assignable to type 'boolean'.
const Item = React.memo(
({ icon, title }: any) => {
return (
<Box
flexDirection="row"
paddingHorizontal="l"
justifyContent="space-between"
alignItems="center"
style={{ marginTop: 35 }}
>
<Box flexDirection="row" alignItems="center" flex={1}>
{icon}
<Box marginLeft="l">
<Text variant="stackHeader">{title}</Text>
<Text
fontSize={15}
fontFamily="CrimsonRegular"
style={{ color: '#575757' }}
>
Last update: 03/06/2020
</Text>
</Box>
</Box>
<TouchableOpacity onPress={() => Clipboard.setString(title as string)}>
<FontAwesome5 name="copy" size={28} color="white" />
</TouchableOpacity>
</Box>
);
},
(prev, next) => { // error here
if (prev.title === next.title) {
return true;
}
}
);