I have react native Loop to fill the select Items like below
const categorylist = arr.map((data, key) => {
if (data != "") {
return <Select.Item label={data} value={data} key={data} />;
}
});
I loop and use it like below , it works fine when array contains non empty values, but when there is empty values i get the error
TypeError: null is not an object (evaluating 'child.props')
<Select>
{categorylist2}
</Select>
How do i send only non empty array items using map. please note i don't want arr to be affected as i need it unchanged in other functions.
reduceinstead of map and filter.