import React from 'react';
import { Map } from 'react-feather';
const details = [
{
title: 'location',
icon: <Map />,
meta: 'foo',
},
{ title: 'type', icon: <Map />, meta: 'type' },
{ title: 'duration', icon: <Map />, meta: 'duration' },
{ title: 'date', icon: <Map />, meta: 'date' },
{ title: 'time', icon: <Map />, meta: 'time' },
];
const DetailList = () => {
return (
<ul>
{details.map(item => (
<li>
<div>
<div>{item.icon}</div>
<div>{item.meta}</div>
</div>
</li>
))}
</ul>
);
};
export default DetailList;
Objective: To map an array and display icon along with other information. However I bumped into error:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
I don't think there is any problem with the import from react-feather. Because I'm able to use it with <div><Map /></div> but not in mapping and render from the array.
Does anyone know what is my problem? Or am I missing anything?
import Map from 'react-feather/dist/icons/map'instead.<div>in a<li>