hi i want to use ternary operator
if cookup has value i want to render
<FlatList
data={cookUp}
keyExtractor={(item) => String(item.id)}
// keyExtractor={(item, index) => {
// return `${index}`;
// }}
renderItem={({item}) => (
<Hey>
{item.name}
</Hey>
)}
/>
but if cookup has a [] like this
i want to render
<Hey>hiaaaaaa</Hey>
here is my code
return (
cookUp ? (
<FlatList
data={cookUp}
keyExtractor={(item) => String(item.id)}
// keyExtractor={(item, index) => {
// return `${index}`;
// }}
renderItem={({item}) => (
<Hey>
{item.name}
</Hey>
)}
/>
) :
(<Hey>hiaaaaaa</Hey>)
);
how can i do this?? how can i fix my code?
