I have a list route with fontAwesome icon declared in it link this -
const navigationList = [
{
pageName: "Dashboard",
path: "/",
iconName: `faChartLine`
},
{
pageName: "Bus Information",
path: "/bus-info",
iconName: `faBus`
},
{
pageName: "Organization Chart",
path: "/org-chart",
iconName: `faSitemap`
}
]
Then, I loop through the array and place it in the Link like this -
{
navigationList.map((link, index) => {
return (
<Link
to={link.path}
key={index}
className={`text-2xl text-gray-500 font-bold p-2`}
>
<FontAwesomeIcon icon={link.iconName} className={"mr-4"}></FontAwesomeIcon>{link.pageName}
</Link>
)
})
}
I see no error in terms of writing the code. But, somehow it shows me index.es.js:278 Could not find icon {prefix: 'fas', iconName: 'faChartLine'}
I tried console log the list and the iconName appears in the console with no error.
Please need your help here. Thanks