在我的下一个JS应用程序中,我将获取数组并将它们映射到导航栏.但当我这样做时,它会抛出一个TypeError: _utils_navigation__WEBPACK_IMPORTED_MODULE_6___default(...).map is not a function
的错误.我的代码如下所示.
{NavRoutes.map((navs, index) => {
console.log(navs.title);
console.log('bhsjvhjvs');
return (
<Link href={navs.link}>
<div className={`${
router.asPath === navs.link
? "text-active-red"
: ""
}`}>{navs.title}</div>
</Link>
)
})}
和数组
const NavRoutes = [
{
title: "HOME",
link: "/"
},
{
title: "NEWS",
link: "/news"
},
{
title: "CHANNEL",
link: "/channels"
},
{
title:"SHOWS",
link: "/shows"
},
{
title: "SCHEDULE",
link: "/schedules"
},
{
title: "CONTACT",
link: "/contact"
},
]
export default NavRoutes;
那么,我如何才能度过难关呢?