What I'm trying to do is to redirect to an external link instead of an existing page on my website.
here is the code for Menu items:
export const MenuItems = [
{
title: 'Marketing',
path: '/marketing',
cName: 'dropdown-link'
},
{
title: 'Consulting',
href: '/consulting',
cName: 'dropdown-link'
},
];
Here is the code for drop down menu:
const [click, setClick] = useState(false);
const handleClick = () => setClick(!click);
return (
<>
<ul
onClick={handleClick}
className={click ? 'dropdown-menu clicked' : 'dropdown-menu'}
>
{MenuItems.map((item, index) => {
return (
<li key={index}>
<Link
className={item.cName}
to={item.path}
onClick={() => setClick(false)}
>
{item.title}
</Link>
</li>
);
})}
</ul>
</>
);
}
export default Dropdown;