I have an array and want to display each item. But map funtion does not work.
export default function SearchField() {
const renderResults = () => {
console.log('array: ', array); // array is consoled
return array.map(element => {
console.log('element', element); // nothing is consoled
return true;
});
};
return (
<div>{renderResults()}</div>
);
}
Here is my array. It is being consoled. But its elements are not mapping and consoling.